Last active
August 29, 2015 14:22
-
-
Save stefanbackor/8fb29306b9ade7365aac to your computer and use it in GitHub Desktop.
Django Grappelli Admin: sidebar changelist with filter highlight
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib import admin | |
class AdminChangelistMixin(admin.ModelAdmin): | |
change_list_template = "grappelli-overrides/change_list_filter_sidebar.html" | |
change_list_filter_template = "grappelli-overrides/filter.html" | |
pass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{# templates/grappelli-overrides/filter.html #} | |
{% load i18n %} | |
<div class="grp-module filter-{{ spec.lookup_kwarg }} filter-{{ spec.lookup_kwarg_isnull }}"> | |
<div class="grp-row"> | |
<label>{% blocktrans with title|capfirst as filter_title %}{{ filter_title }}{% endblocktrans %}</label> | |
<select class="grp-filter-choice"> | |
{% for choice in choices %}<option value="{{ choice.query_string|iriencode }}"{% if choice.selected %} selected='selected'{% endif %}>{{ choice.display }}</option>{% endfor %} | |
</select> | |
</div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment