#29861 closed Cleanup/optimization (invalid)
Use timezone.now() instead of datetime.now() for TimeField's auto_now/auto_now_add
Description ¶
On jango db model Class DateTimeField when using arguments like auto_now*
the time will be set on that field value using timezone.now()
.
While its sibling class TimeField' uses datetime.datetime.now()
to set the value.
Maybe it makes more sense to just use timezone.now()
in both places.
Change History (1)
comment:1 by , 6 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
Summary: | Using timezone.now() instead of datetime.now() on class TimeField → Use timezone.now() instead of datetime.now() for TimeField's auto_now/auto_now_add |
Note:
See TracTickets
for help on using tickets.
Unlike
DateTimeField
,TimeField
isn't timezone-aware. See #18691, #27306, and a pull request thread where the change you suggested was proposed.