[Django] #29204: Problems with Django and timezone

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[Django] #29204: Problems with Django and timezone

Django
#29204: Problems with Django and timezone
-----------------------------------------+------------------------
               Reporter:  ovalseven8     |          Owner:  nobody
                   Type:  Uncategorized  |         Status:  new
              Component:  Uncategorized  |        Version:  2.0
               Severity:  Normal         |       Keywords:
           Triage Stage:  Unreviewed     |      Has patch:  0
    Needs documentation:  0              |    Needs tests:  0
Patch needs improvement:  0              |  Easy pickings:  0
                  UI/UX:  0              |
-----------------------------------------+------------------------
 First of all my settings.py:

 {{{
 LANGUAGE_CODE = 'de-DE'

 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(default=timezone.now, 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:
 [[Image(https://i.imgur.com/GGUuCsZ.png)]]

 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.**
 [[Image(https://i.imgur.com/H4IV0e5.png)]]

 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?

--
Ticket URL: <https://code.djangoproject.com/ticket/29204>
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/053.e0697998f095df8682e2dae7fb4d540b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #29204: Problems with Django and timezone

Django
#29204: Problems with Django and timezone
-------------------------------+--------------------------------------
     Reporter:  ovalseven8     |                    Owner:  nobody
         Type:  Uncategorized  |                   Status:  closed
    Component:  Uncategorized  |                  Version:  2.0
     Severity:  Normal         |               Resolution:  invalid
     Keywords:                 |             Triage Stage:  Unreviewed
    Has patch:  0              |      Needs documentation:  0
  Needs tests:  0              |  Patch needs improvement:  0
Easy pickings:  0              |                    UI/UX:  0
-------------------------------+--------------------------------------
Changes (by Tim Graham):

 * status:  new => closed
 * resolution:   => invalid


Comment:

 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.

--
Ticket URL: <https://code.djangoproject.com/ticket/29204#comment:1>
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/068.a4db104dfa758ef42f057a55b3efd9a9%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.