models.py 573 B

12345678910111213141516
  1. import uuid
  2. from django.db import models
  3. from django.utils.translation import gettext_lazy as _
  4. class AbstractModel(models.Model):
  5. uuid = models.UUIDField(_("UUID"),
  6. default=uuid.uuid4,
  7. unique=True, editable=False,
  8. db_index=True)
  9. created_at = models.DateTimeField(_("Дата создания"), auto_now_add=True)
  10. updated_at = models.DateTimeField(_("Дата обновления"), auto_now=True)
  11. class Meta:
  12. abstract = True
  13. ordering = ["-created_at"]