{% load i18n djadmin %} {% dj_date_filter spec choices as date_range %}
{{ title|capfirst }} {% dj_icon "chevron-down" "dj-icon dj-icon--xs dj-filter-chevron" %} {% if date_range %} {% comment %} Django renders a date filter as five links stacked down the sidebar (Any date / Today / Past 7 days / This month / This year). The same filter reads as a row of chips plus one range field. Every chip is a plain link carrying the __gte / __lt pair that DateFieldListFilter expects, so the common ranges work with JavaScript switched off. The custom range does not: its two visible inputs are deliberately nameless, and JavaScript copies their values into the hidden parameters below. An empty parameter would reach the queryset as `field__gte=""` and bounce the whole changelist to ?e=1, so a field that is not filled in must not be submitted at all. {% endcomment %}
{% translate "Any date" %} {% for shortcut in date_range.shortcuts %} {{ shortcut.label }} {% endfor %}
{% else %} {% endif %}