You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
579 B
21 lines
579 B
import uuid
|
|
from django.db import models
|
|
|
|
class BaseModel(models.Model):
|
|
"""
|
|
Abstract base model that uses a UUID for its primary key instead of an integer.
|
|
"""
|
|
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
|
|
|
class Meta:
|
|
abstract = True
|
|
|
|
class TimeStampedModel(BaseModel):
|
|
"""
|
|
Abstract base model that adds self-updating created_at and updated_at fields.
|
|
"""
|
|
created_at = models.DateTimeField(auto_now_add=True)
|
|
updated_at = models.DateTimeField(auto_now=True)
|
|
|
|
class Meta:
|
|
abstract = True
|