Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class BaseModel(models.Model):
- id = models.UUIDField(default=uuid.uuid4, editable=False, db_index=True, unique=True, primary_key=True)
- updated_at = models.DateTimeField(db_index=True, auto_now=True)
- updated_by = models.CharField(max_length=200)
- responded_at = models.DateTimeField(db_index=True, null=True, blank=True)
- responded_by = models.CharField(max_length=200, null=True, blank=True)
- from django.utils import timezone
- class AutoDateTimeField(models.DateTimeField):
- def pre_save(self, model_instance, add):
- return timezone.now()
- class BaseModel(models.Model):
- updated_at = models.AutoDateTimeField(default=timezone.now)
- # ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement