diff options
author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2019-07-20 15:38:43 +0200 |
---|---|---|
committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2019-12-04 18:22:08 +0100 |
commit | c06492dd87342b5102db44f0d50fa0bb01cbb743 (patch) | |
tree | 25c8ba9910ed0851b4efd6bb81fb298adef420a2 /django/db/backends/postgresql/base.py | |
parent | ad88524e4db91dc2f148cf40184a81a454ee7aac (diff) | |
download | django-c06492dd87342b5102db44f0d50fa0bb01cbb743.tar.gz |
Fixed #23524 -- Allowed DATABASES['TIME_ZONE'] option on PostgreSQL.
Diffstat (limited to 'django/db/backends/postgresql/base.py')
-rw-r--r-- | django/db/backends/postgresql/base.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/django/db/backends/postgresql/base.py b/django/db/backends/postgresql/base.py index bf15a13018..0ab81ced74 100644 --- a/django/db/backends/postgresql/base.py +++ b/django/db/backends/postgresql/base.py @@ -47,7 +47,6 @@ from .features import DatabaseFeatures # NOQA isort:skip from .introspection import DatabaseIntrospection # NOQA isort:skip from .operations import DatabaseOperations # NOQA isort:skip from .schema import DatabaseSchemaEditor # NOQA isort:skip -from .utils import utc_tzinfo_factory # NOQA isort:skip psycopg2.extensions.register_adapter(SafeString, psycopg2.extensions.QuotedString) psycopg2.extras.register_uuid() @@ -231,9 +230,12 @@ class DatabaseWrapper(BaseDatabaseWrapper): cursor = self.connection.cursor(name, scrollable=False, withhold=self.connection.autocommit) else: cursor = self.connection.cursor() - cursor.tzinfo_factory = utc_tzinfo_factory if settings.USE_TZ else None + cursor.tzinfo_factory = self.tzinfo_factory if settings.USE_TZ else None return cursor + def tzinfo_factory(self, offset): + return self.timezone + @async_unsafe def chunked_cursor(self): self._named_cursor_idx += 1 |