diff options
| author | Haki Benita <hakibenita@gmail.com> | 2017-12-16 20:48:40 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2018-02-13 14:12:40 -0500 |
| commit | 2014db50f4522243dba3190c640f64cf124d5b68 (patch) | |
| tree | 6a7f399793c83ad7ba3e136620a500bced4a5adc | |
| parent | 5a669ae2f4e1665f475d384ab762bcf4ddc5660b (diff) | |
Removed redundant filtering in date_hierarchy template tag.
cl.queryset is already filtered by the current selections.
| -rw-r--r-- | django/contrib/admin/templatetags/admin_list.py | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/django/contrib/admin/templatetags/admin_list.py b/django/contrib/admin/templatetags/admin_list.py index 604021c55d..eeb56c0aa4 100644 --- a/django/contrib/admin/templatetags/admin_list.py +++ b/django/contrib/admin/templatetags/admin_list.py @@ -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': { |
