22 lines
416 B
Python
22 lines
416 B
Python
import uuid
|
|
|
|
from django.db import models
|
|
|
|
|
|
class UUIDModel(models.Model):
|
|
class Meta:
|
|
abstract = True
|
|
|
|
uuid = models.UUIDField(
|
|
primary_key=True,
|
|
default=uuid.uuid4,
|
|
editable=False,
|
|
)
|
|
|
|
|
|
class CreatedUpdatedModel(models.Model):
|
|
class Meta:
|
|
abstract = True
|
|
|
|
created = models.DateTimeField(auto_now_add=True)
|
|
updated = models.DateTimeField(auto_now=True) |