#32320 closed Bug (invalid)
DateField uses unlocalized function when auto_now is True — at Version 1
Reported by: | M1ha Shvn | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
Severity: | Normal | Keywords: | auto_now DateField USE_TZ |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
Hi.
django.db.models.fields.DateField(auto_now=True)
sets date as datetime.date.today()
(see here). This date is not localized with django and can be different from django.utils.timezone.now()
used in DateTimeField
, if django and local timzeones differ.
Suggestion:
Change datetime.date.today()
to django.utils.timezone.now().date()
Change History (1)
comment:1 by , 4 years ago
Description: | modified (diff) |
---|---|
Resolution: | → invalid |
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
This is a documented behavior: