0
0
mirror of https://github.com/django/django.git synced 2024-12-01 15:42:04 +01:00

Removed redundant filtering in date_hierarchy template tag.

cl.queryset is already filtered by the current selections.
This commit is contained in:
Haki Benita 2017-12-16 20:48:40 +02:00 committed by Tim Graham
parent 5a669ae2f4
commit 2014db50f4

View File

@ -370,8 +370,7 @@ def date_hierarchy(cl):
'choices': [{'title': capfirst(formats.date_format(day, 'MONTH_DAY_FORMAT'))}]
}
elif year_lookup and month_lookup:
days = cl.queryset.filter(**{year_field: year_lookup, month_field: month_lookup})
days = getattr(days, 'dates')(field_name, 'day')
days = getattr(cl.queryset, 'dates')(field_name, 'day')
return {
'show': True,
'back': {
@ -384,8 +383,7 @@ def date_hierarchy(cl):
} for day in days]
}
elif year_lookup:
months = cl.queryset.filter(**{year_field: year_lookup})
months = getattr(months, 'dates')(field_name, 'month')
months = getattr(cl.queryset, 'dates')(field_name, 'month')
return {
'show': True,
'back': {