Created
July 11, 2019 17:36
-
-
Save gomasaba/0834c76f0834820921b62e62f94f3c1f to your computer and use it in GitHub Desktop.
BooleanDropdownFilter
This file contains 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
# stdlib | |
# lib | |
from django.contrib.admin.filters import ( | |
BooleanFieldListFilter, | |
) | |
# app | |
class BooleanDropdownFilter(BooleanFieldListFilter): | |
template = 'boolean_dropdown_filter.html' |
This file contains 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
{% load i18n %} | |
<script type="text/javascript">var go_from_select = function(opt) { window.location = window.location.pathname + opt };</script> | |
<h3>{% blocktrans with title as filter_title %} By {{ filter_title }} {% endblocktrans %}</h3> | |
<ul class="admin-filter-{{ title|cut:' ' }}"> | |
<li> | |
<select class="form-control" style="width: 95%;margin-left: 2%;" | |
onchange="go_from_select(this.options[this.selectedIndex].value)"> | |
{% for choice in choices %} | |
<option{% if choice.selected %} selected="selected"{% endif %} | |
value="{{ choice.query_string|iriencode }}">{{ choice.display }}</option> | |
{% endfor %} | |
</select> | |
</li> | |
</ul> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment