#30638: Allow the per-database TIME_ZONE option on databases that support
timezones.
-------------------------------------+-------------------------------------
     Reporter:  Aymeric Augustin     |                    Owner:  nobody
         Type:  New feature          |                   Status:  new
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     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 Aymeric Augustin):

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


Comment:

 Let me try to explain again.

 I'm reading data in a third-party PostgreSQL database where `timestamp`
 columns contains values in UTC. I'm using non-managed models and the admin
 to give users read-only access to this database. As far as I know, all
 these things are legitimate things to do with Django.

 Since my global TIME_ZONE setting is Europe/Paris (CET/UTC+1 or
 CEST/UTC+2), if a row in this database contains a value that is 9am (UTC),
 then the admin should show 11am (CEST). However, the admin shows 9am.

 Since the admin doesn't show the correct values, users are confused. Since
 Django doesn't give me a way to configure this, I'm frustrated.

 ----

 I think that the following configuration would adequately reflect the
 situation:

 {{{
 USE_TZ = True

 DATABASES = {
     ...,
     'other': {
         ...,
         'TIME_ZONE': 'UTC',
     },
 }
 }}}

 Unfortunately, if I do this, Django throws an error, because of this check
 which I wrote in ed83881e648:
 {{{

     def check_settings(self):
         if self.settings_dict['TIME_ZONE'] is not None:
             ...
             elif self.features.supports_timezones:
                 raise ImproperlyConfigured(
                     "Connection '%s' cannot set TIME_ZONE because its
 engine "
                     "handles time zones conversions natively." %
 self.alias)
 }}}


 I'm proposing to change Django so it will accept this configuration and
 get the right values from the database and display them correctly in the
 admin.

 Essentially this requires two changes in the PostgreSQL backend:

 - adding a database converter for datetimes
 - updating the database adapter for datetimes

 and, of course, removing the code that prevents this configuration.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/30638#comment:5>
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.dbfcc2e50c641ad3c81f5864e0388d71%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to