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:
committed by
Baptiste Mispelon
parent
3e845b79ce
commit
17ed99f3a3
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user