#32320: DateField uses unlocalized function when auto_now is True
-------------------------------------+-------------------------------------
               Reporter:  M1ha-Shvn  |          Owner:  nobody
                   Type:  Bug        |         Status:  new
              Component:  Database   |        Version:  master
  layer (models, ORM)                |       Keywords:  auto_now DateField
               Severity:  Normal     |  USE_TZ
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 Hi.

 `django.db.models.fields.DateField(auto_now=True)` sets date as
 `datetime.date.today()` (see
 
[here](https://github.com/django/django/blob/master/django/db/models/fields/__init__.py#L1246)).
 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()`

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32320>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/052.e3e08a8eddbc0ccd1c03eaafaf03358e%40djangoproject.com.

Reply via email to