initial commit
This commit is contained in:
28
core/utils/base_model.py
Normal file
28
core/utils/base_model.py
Normal file
@@ -0,0 +1,28 @@
|
||||
import uuid
|
||||
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.db import models
|
||||
|
||||
from django_core.models.base import AbstractBaseModel # type: ignore
|
||||
|
||||
|
||||
class UUIDPrimaryKeyBaseModel(AbstractBaseModel):
|
||||
id = models.UUIDField(
|
||||
verbose_name=_("ID"),
|
||||
primary_key=True,
|
||||
default=uuid.uuid4,
|
||||
editable=False,
|
||||
)
|
||||
|
||||
created_at = models.DateTimeField(
|
||||
verbose_name=_("Created At"),
|
||||
auto_now_add=True
|
||||
)
|
||||
|
||||
updated_at = models.DateTimeField(
|
||||
verbose_name=_("Updated At"),
|
||||
auto_now=True
|
||||
)
|
||||
|
||||
class Meta: # type: ignore # noqa
|
||||
abstract = True
|
||||
Reference in New Issue
Block a user