Opened 3 years ago

Closed 3 years ago

#29204 closed Uncategorized (invalid)

Problems with Django and timezone

Reported by: ovalseven8 Owned by: nobody
Component: Uncategorized Version: 2.0
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


First of all my


TIME_ZONE = 'Europe/Berlin'

USE_I18N = True

USE_L10N = True

USE_TZ = True

Also, I have a model with one DateTimeField:

from django.utils import timezone

class CustomModel(models.Model):
   time = models.DateTimeField(, editable=False)

However, I have a problem in my admin: It's ~ 22:00 now (my local time). When I create an instance of CustomModel, it looks so in the admin page:

You can see the inconsistency? I do not know if the time is saved correctly because it's 22:00 in my time zone.

Now look, if I change my CustomModel:

class CustomModel(models.Model):
    time = models.DateTimeField(auto_now_add=True)

The admin page looks so now (no inconsistencies anymore!). However, it's 22:12 in my time zone now.

So there is definitely a bug somewhere.

Anyway, I have a question:
What should I do, is the time saved correctly and only the display wrong?

Change History (1)

comment:1 Changed 3 years ago by Tim Graham

Resolution: invalid
Status: newclosed

This is probably a lack of understanding of how Django works. See TicketClosingReasons/UseSupportChannels for ways to get help. If you confirm a bug in Django through those channels, please reopen the ticket and explain why Django is at fault.

Note: See TracTickets for help on using tickets.
Back to Top