diff options
| author | Loic Bistuer <loic.bistuer@sixmedia.com> | 2013-11-14 16:32:55 +0700 |
|---|---|---|
| committer | Baptiste Mispelon <bmispelon@gmail.com> | 2013-11-14 21:36:55 +0100 |
| commit | 17ed99f3a3eea4bd27fa34be59c3582616ed8079 (patch) | |
| tree | 4f68a1baa8934f3bdfecb0cc0b959a3954f2cdcd /django | |
| parent | 3e845b79ce9f74c0942e2c41259d33bd835f2941 (diff) | |
Fixed #21432 -- DateTimeQuery now copies tzinfo when cloning.
Thanks Enrique MartÃnez for the report and @bmispelon for the tests.
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/models/sql/subqueries.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/django/db/models/sql/subqueries.py b/django/db/models/sql/subqueries.py index 17438bc359..79db1ad99a 100644 --- a/django/db/models/sql/subqueries.py +++ b/django/db/models/sql/subqueries.py @@ -260,6 +260,11 @@ class DateTimeQuery(DateQuery): compiler = 'SQLDateTimeCompiler' + def clone(self, klass=None, memo=None, **kwargs): + if 'tzinfo' not in kwargs and hasattr(self, 'tzinfo'): + kwargs['tzinfo'] = self.tzinfo + return super(DateTimeQuery, self).clone(klass, memo, **kwargs) + def _check_field(self, field): assert isinstance(field, DateTimeField), \ "%r isn't a DateTimeField." % field.name |
