1
0
mirror of https://github.com/django/django.git synced 2025-10-25 14:46:09 +00:00

Fixed #21432 -- DateTimeQuery now copies tzinfo when cloning.

Thanks Enrique Martínez for the report and @bmispelon for the tests.
This commit is contained in:
Loic Bistuer
2013-11-14 16:32:55 +07:00
committed by Baptiste Mispelon
parent 3e845b79ce
commit 17ed99f3a3
2 changed files with 22 additions and 1 deletions

View File

@@ -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