Clean up apps and replace example_api with example
This commit is contained in:
parent
32e1bd265a
commit
eb5ab42e1c
|
@ -7,7 +7,18 @@ from django.utils.translation import gettext_lazy as _
|
|||
user_model = settings.AUTH_USER_MODEL
|
||||
|
||||
|
||||
|
||||
class IsDeletedManager(models.Manager):
|
||||
def get_queryset(self):
|
||||
return super().get_queryset().filter(is_deleted=False)
|
||||
|
||||
|
||||
|
||||
class BaseModel(models.Model):
|
||||
"""
|
||||
Tracks instance creations, updates, and (soft) deletions.
|
||||
"""
|
||||
|
||||
uid = models.UUIDField(
|
||||
verbose_name=_("UUID"), unique=True, default=uuid.uuid4, editable=False
|
||||
)
|
||||
|
@ -41,5 +52,22 @@ class BaseModel(models.Model):
|
|||
verbose_name=_("Updated at"), auto_now=True, null=True, blank=True
|
||||
)
|
||||
|
||||
deleted_by = models.ForeignKey(
|
||||
to=user_model,
|
||||
verbose_name=_("Deleted by"),
|
||||
null=True,
|
||||
blank=True,
|
||||
related_name="%(class)s_deleted",
|
||||
on_delete=models.SET_NULL,
|
||||
)
|
||||
|
||||
deleted_at = models.DateTimeField(verbose_name=_("Deleted at"), null=True, blank=True)
|
||||
|
||||
is_deleted = models.BooleanField(verbose_name=_("Is deleted"), default=False)
|
||||
|
||||
objects = IsDeletedManager()
|
||||
|
||||
objects_all = models.Manager()
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
# Your custom management commands go here.
|
|
@ -0,0 +1 @@
|
|||
# Your services go here
|
|
@ -0,0 +1 @@
|
|||
# Your urls go here
|
Loading…
Reference in New Issue