Skip to content

Instantly share code, notes, and snippets.

@daviferreira
Created July 8, 2011 16:28
Show Gist options
  • Save daviferreira/1072198 to your computer and use it in GitHub Desktop.
Save daviferreira/1072198 to your computer and use it in GitHub Desktop.
How to change django's list_filter order
{% load i18n %}
<h3>{% blocktrans with title as filter_title %} By {{ filter_title }} {% endblocktrans %}</h3>
<ul>
<li {% if choices.0.selected %}class="selected"{% endif %}><a href="?"><strong>All</strong></a></li>
{% for choice in choices|dictsort:"display" %}
{% if choice.query_string != "?" %}
<li {% if choice.selected %}class="selected"{% endif %}><a href="{{ choice.query_string|iriencode }}">{{ choice.display }}</a></li>
{% endif %}
{% endfor %}
</ul>
@dusual
Copy link

dusual commented Mar 17, 2017

How do I use this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment