This issue has been occurring on and off for a few weeks now, and it\'s unlike any that has come up with my project.
Two of the models that are used have a timestam
Just set the parameter auto_now_add
like this.
timestamp = models.DateTimeField(auto_now_add=True)
Update:
Please don't use auto_now_add
. It is not the recommended way, instead do this:
from django.utils import timezone
timestamp = models.DateTimeField(default=timezone.now)
Just ran into this last week for a field that had default=date.today()
. If you remove the parentheses (in this case, try default=timezone.now
) then you're passing a callable to the model and it will be called each time a new instance is saved. With the parentheses, it's only being called once when models.py
loads.