auto_now_add fields override my input
Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Ancient Construction
--
Chapters
00:00 Question
00:42 Accepted answer (Score 2)
01:20 Thank you
--
Full question
https://stackoverflow.com/questions/4221...
Accepted answer links:
[docs]: https://docs.djangoproject.com/en/1.10/r...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #django #djangomodels
#avk47
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Ancient Construction
--
Chapters
00:00 Question
00:42 Accepted answer (Score 2)
01:20 Thank you
--
Full question
https://stackoverflow.com/questions/4221...
Accepted answer links:
[docs]: https://docs.djangoproject.com/en/1.10/r...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #django #djangomodels
#avk47
ACCEPTED ANSWER
Score 2
From the docs:
The auto_now and auto_now_add options will always use the date in the default timezone at the moment of creation or update. If you need something different, you may want to consider simply using your own callable default or overriding save() instead of using auto_now or auto_now_add; or using a DateTimeField instead of a DateField and deciding how to handle the conversion from datetime to date at display time.
So you should do that instead
bar = models.DateTimeField(default=date.today)