Untitled

 avatar
unknown
plain_text
5 months ago
923 B
3
Indexable
class EntityQuerySet(QuerySet):
    pass

class EntityManager(models.Manager):
    def get_queryset(self):
        return EntityQuerySet(
            model=self.model,
            using=self._db,
            hints=self._hints,
        )

class Entity(models.Model):
    id = models.UUIDField(  # noqa: VNE003
        primary_key=True,
        default=uuid4,
        editable=False,
    )
    created_at = models.DateTimeField(
        auto_now_add=True,
        editable=False,
        help_text=_('created_at'),
        verbose_name=_('created_at'),
    )
    updated_at = models.DateTimeField(
        auto_now=True,
        editable=False,
        help_text=_('updated_at'),
        verbose_name=_('updated_at'),
    )
    is_active = models.BooleanField(
        default=True,
        help_text=_('is_active'),
        verbose_name=_('is_active'),
    )
    objects = EntityManager()
Editor is loading...
Leave a Comment