In your model class, we can set the auto_now_add and auto_add in the DateField or DateTimeField for creation date and update date.
from django.db import models
class Person(models.Model):
name = models.CharField(max_length=256)
homepage = models.URLField(max_length=256)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
def __unicode__(self):
return self.name
The auto_now_add will make the field read only while the auto_now will refresh the the field value when a .save() is executed.
Done =)
Reference: Django documentation – DateField
