[Django] #16380: admin_list_filter should pass the spec to the template

21 views
Skip to first unread message

Django

unread,
Jun 30, 2011, 8:09:33 AM6/30/11
to django-...@googlegroups.com
#16380: admin_list_filter should pass the spec to the template
-------------------------+-------------------------------
Reporter: hvdklauw | Owner: nobody
Type: New feature | Status: new
Milestone: 1.4 | Component: contrib.admin
Version: SVN | Severity: Normal
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------+-------------------------------
If the admin_list_filter inclusion tag also passed the spec object to the
admin/filter.html template we could write custom filterspec's that have
attributes that influence the way the filterspec is displayed (in a
dropdown with javascript for instance).

Right now you have to override the change_list.html, and create your own
template tag to do this and then still override the admin/filter.html to
actually change how it's displayed.

--
Ticket URL: <https://code.djangoproject.com/ticket/16380>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jun 30, 2011, 8:14:42 AM6/30/11
to django-...@googlegroups.com
#16380: admin_list_filter should pass the spec to the template
---------------------------------------+-------------------------------
Reporter: hvdklauw | Owner: nobody
Type: New feature | Status: new
Milestone: 1.4 | Component: contrib.admin
Version: SVN | Severity: Normal
Resolution: | Keywords:
Triage Stage: Unreviewed | Has patch: 1
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
---------------------------------------+-------------------------------
Changes (by hvdklauw):

* needs_better_patch: => 0
* has_patch: 0 => 1
* needs_tests: => 0
* easy: 0 => 1
* needs_docs: => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/16380#comment:1>

Django

unread,
Jun 30, 2011, 8:20:28 AM6/30/11
to django-...@googlegroups.com
#16380: admin_list_filter should pass the spec to the template
---------------------------------------+-------------------------------
Reporter: hvdklauw | Owner: nobody
Type: New feature | Status: new
Milestone: 1.4 | Component: contrib.admin
Version: SVN | Severity: Normal
Resolution: | Keywords:
Triage Stage: Accepted | Has patch: 1
Needs documentation: 1 | Needs tests: 1
Patch needs improvement: 1 | Easy pickings: 0
UI/UX: 0 |
---------------------------------------+-------------------------------
Changes (by jezdez):

* needs_better_patch: 0 => 1
* needs_docs: 0 => 1
* needs_tests: 0 => 1
* easy: 1 => 0
* stage: Unreviewed => Accepted


Comment:

While this is an interesting idea, this needs an actual example and tests.

--
Ticket URL: <https://code.djangoproject.com/ticket/16380#comment:2>

Django

unread,
Jun 30, 2011, 8:32:51 AM6/30/11
to django-...@googlegroups.com
#16380: admin_list_filter should pass the spec to the template
---------------------------------------+-------------------------------
Reporter: hvdklauw | Owner: nobody
Type: New feature | Status: new
Milestone: 1.4 | Component: contrib.admin
Version: SVN | Severity: Normal
Resolution: | Keywords:
Triage Stage: Accepted | Has patch: 1
Needs documentation: 1 | Needs tests: 1
Patch needs improvement: 1 | Easy pickings: 0
UI/UX: 0 |
---------------------------------------+-------------------------------

Comment (by hvdklauw):

Example admin/filter.html


{{{
{% load i18n %}
<h3>{% blocktrans with title as filter_title %} By {{ filter_title }} {%
endblocktrans %}</h3>
{% if spec.field.related and choices|length > 5 %}
<select class="filter_choice">
{% for choice in choices %}
<option value="{{ choice.query_string|iriencode }}"{% if
choice.selected %} selected='selected'{% endif %}>{{ choice.display|safe
}}</option>
{% endfor %}
</select>
{% else %}
<ul>
{% for choice in choices %}
<li{% if choice.selected %} class="selected"{% endif %}>
<a href="{{ choice.query_string|iriencode }}">{{ choice.display
}}</a></li>
{% endfor %}
</ul>
{% endif %}
}}}

And this little bit of javascript somewhere on document.ready:
{{{
$(".filter_choice").change(function() {
location.href = $(this).val();
});
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/16380#comment:3>

Django

unread,
Jun 30, 2011, 10:28:10 AM6/30/11
to django-...@googlegroups.com
#16380: admin_list_filter should pass the spec to the template
---------------------------------------+-------------------------------
Reporter: hvdklauw | Owner: nobody
Type: New feature | Status: new
Milestone: 1.4 | Component: contrib.admin
Version: SVN | Severity: Normal
Resolution: | Keywords:
Triage Stage: Accepted | Has patch: 1
Needs documentation: 1 | Needs tests: 1
Patch needs improvement: 1 | Easy pickings: 0
UI/UX: 0 |
---------------------------------------+-------------------------------

Comment (by jezdez):

Nice! Let's put something like that in the docs.

--
Ticket URL: <https://code.djangoproject.com/ticket/16380#comment:4>

Django

unread,
Dec 18, 2013, 5:08:55 AM12/18/13
to django-...@googlegroups.com
#16380: admin_list_filter should pass the spec to the template
-------------------------------+------------------------------------

Reporter: hvdklauw | Owner: nobody
Type: New feature | Status: new
Component: contrib.admin | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by bruno@…):

* cc: bruno@… (added)


Comment:

This ticket could be closed, `admin_list_filter` is now (in v1.6 at least)
a `simple_tag` that uses the spec's template AND pass the spec to the
template (cf
https://github.com/django/django/blob/master/django/contrib/admin/templatetags/admin_list.py
line 409).

--
Ticket URL: <https://code.djangoproject.com/ticket/16380#comment:6>

Django

unread,
Dec 18, 2013, 5:52:32 AM12/18/13
to django-...@googlegroups.com
#16380: admin_list_filter should pass the spec to the template
-------------------------------+------------------------------------
Reporter: hvdklauw | Owner: nobody
Type: New feature | Status: closed
Component: contrib.admin | Version: master
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by bmispelon):

* status: new => closed
* resolution: => fixed


Comment:

Hi,

Thanks for digging up these old out-of-date tickets
FYI, you don't need special permmissions to close a ticket here and you
can do so yourself.

Putting the commit id in the comment when you close a ticket will help us
double check.

In this case, this issue appears to have been fixed in
4dbeb4bca4638ff851a2f4844d262dbe1652f7b5.

Thanks.

--
Ticket URL: <https://code.djangoproject.com/ticket/16380#comment:7>

Django

unread,
Dec 18, 2013, 5:56:48 AM12/18/13
to django-...@googlegroups.com
#16380: admin_list_filter should pass the spec to the template
-------------------------------+------------------------------------
Reporter: hvdklauw | Owner: nobody

Type: New feature | Status: closed
Component: contrib.admin | Version: master
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------

Comment (by bruno@…):

@bmispelon: ok will do next time.

--
Ticket URL: <https://code.djangoproject.com/ticket/16380#comment:8>

Reply all
Reply to author
Forward
0 new messages