Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Used QuerySet.datetimes in date-based generic views.

  • Loading branch information...
commit 0d0de288a5210fa106cd4350961eb2006535cc5c 1 parent 9c0859f
@aaugustin aaugustin authored
Showing with 6 additions and 3 deletions.
  1. +6 −3 django/views/generic/dates.py
View
9 django/views/generic/dates.py
@@ -379,15 +379,18 @@ def get_date_list_period(self):
def get_date_list(self, queryset, date_type=None, ordering='ASC'):
"""
- Get a date list by calling `queryset.dates()`, checking along the way
- for empty lists that aren't allowed.
+ Get a date list by calling `queryset.dates/datetimes()`, checking
+ along the way for empty lists that aren't allowed.
"""
date_field = self.get_date_field()
allow_empty = self.get_allow_empty()
if date_type is None:
date_type = self.get_date_list_period()
- date_list = queryset.dates(date_field, date_type, ordering)
+ if self.uses_datetime_field:
+ date_list = queryset.datetimes(date_field, date_type, ordering)
+ else:
+ date_list = queryset.dates(date_field, date_type, ordering)
if date_list is not None and not date_list and not allow_empty:
name = force_text(queryset.model._meta.verbose_name_plural)
raise Http404(_("No %(verbose_name_plural)s available") %

0 comments on commit 0d0de28

Please sign in to comment.
Something went wrong with that request. Please try again.