Search posts, tags, users, and pages
Setting auto_now and auto_now_add to True will automatically set a DateField or a DateTimeField to the current date and time. This works great for "created" and "modified" fields. However, suppose you're importing content from another system, and you...
Seth Livingston
@sethl · Dallas, TX
Technical Lead for CultureMap, InnovationMap, SportsMap, & AutomotiveMap. Python, Django, Elm, & JavaScript.
Markdown supported · ⌘↵ to post
Mark
(And don't accidentally write
created = models.DateTimeField(default=timezone.now())
because then you get the server start time. Not that I ever did something like that and not notice it for weeks...)
Mark
(And don't accidentally write
created = models.DateTimeField(default=timezone.now())because then you get the server start time. Not that I ever did something like that and not notice it for weeks...)