mirror of
https://github.com/django/django.git
synced 2025-10-29 08:36:09 +00:00
Refs #29724 -- Added is_dst parameter to QuerySet.datetimes().
Thanks Simon Charette for the review and Mariusz Felisiak for tests.
This commit is contained in:
committed by
Mariusz Felisiak
parent
2695ac8e04
commit
53b6a466d8
@@ -875,7 +875,7 @@ class QuerySet:
|
||||
'datefield', flat=True
|
||||
).distinct().filter(plain_field__isnull=False).order_by(('-' if order == 'DESC' else '') + 'datefield')
|
||||
|
||||
def datetimes(self, field_name, kind, order='ASC', tzinfo=None):
|
||||
def datetimes(self, field_name, kind, order='ASC', tzinfo=None, is_dst=None):
|
||||
"""
|
||||
Return a list of datetime objects representing all available
|
||||
datetimes for the given field_name, scoped to 'kind'.
|
||||
@@ -890,7 +890,13 @@ class QuerySet:
|
||||
else:
|
||||
tzinfo = None
|
||||
return self.annotate(
|
||||
datetimefield=Trunc(field_name, kind, output_field=DateTimeField(), tzinfo=tzinfo),
|
||||
datetimefield=Trunc(
|
||||
field_name,
|
||||
kind,
|
||||
output_field=DateTimeField(),
|
||||
tzinfo=tzinfo,
|
||||
is_dst=is_dst,
|
||||
),
|
||||
plain_field=F(field_name)
|
||||
).values_list(
|
||||
'datetimefield', flat=True
|
||||
|
||||
Reference in New Issue
Block a user