From 17ed99f3a3eea4bd27fa34be59c3582616ed8079 Mon Sep 17 00:00:00 2001 From: Loic Bistuer Date: Thu, 14 Nov 2013 16:32:55 +0700 Subject: Fixed #21432 -- DateTimeQuery now copies tzinfo when cloning. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thanks Enrique Martínez for the report and @bmispelon for the tests. --- django/db/models/sql/subqueries.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'django/db/models/sql') 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 -- cgit v1.3