Skip to content

Commit

Permalink
campaign models created
Browse files Browse the repository at this point in the history
  • Loading branch information
abdullai-t committed Dec 5, 2023
1 parent 26f2711 commit fdebc52
Show file tree
Hide file tree
Showing 8 changed files with 580 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/_main_/utils/base_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from django.db import models
import uuid



class BaseModel(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
is_deleted = models.BooleanField(default=False)
# to store any extra meta data
info = models.JSONField(blank=True, null=True)

def __str__(self):
return str(self.id)

def to_json(self, full=False, tiny_info=False):
return {
"id": str(self.pk),
"created_at": self.created_at,
"updated_at": self.updated_at,
"is_deleted": self.is_deleted,
"info": self.info
}

class Meta:
abstract = True
Empty file added src/apps__campaigns/__init__.py
Empty file.
3 changes: 3 additions & 0 deletions src/apps__campaigns/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.
5 changes: 5 additions & 0 deletions src/apps__campaigns/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.apps import AppConfig


class AppsCampaignsConfig(AppConfig):
name = 'apps__campaigns'
Empty file.
Loading

0 comments on commit fdebc52

Please sign in to comment.