Is it possible to add to existing fields auto_nowand auto_now_addDateTime>
class ExistingModel(models.Model):
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
We cannot add these fields without default, but adding a value defaultgives an error:
./manage.py makemigrations
returns:
(fields.E160) The options auto_now, auto_now_add, and default are mutually exclusive. Only one of these options may be present.
source
share