Here's how I achieved it.

{% load i18n %} 
{% if choices|length > 9  %}
<h3>{% blocktrans with title|escape as filter_title %} By {{ filter_title 
}} {% endblocktrans %}</h3> 
<FORM>
<SELECT  style="width:100%" id="filter-{{ title|escape }}" 
 onchange="window.location=this.value"> 
{% for choice in choices %} 
<OPTION{% if choice.selected %} selected="selected"{% endif %} value="{{ 
choice.query_string|iriencode }}">{{ choice.display|escape }}</OPTION> 
{% endfor %} 
</SELECT> 
</FORM>
{% else %}
<h3>{% blocktrans with title as filter_title %} By {{ filter_title }} {% 
endblocktrans %}</h3>
<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 %}

The else option is simply a duplication of djangos own admin/filter.html





On Friday, 1 February 2008 10:55:21 UTC+1, Julien wrote:
>
> Hello there, 
>
> The list_filter meta attribute lets you add filters in the admin 
> interface. It's great, but the problem is that the field I'm filtering 
> (a ForeignKey) has thousands of values, so I get thousands of links 
> put in the right end side of the page. 
>
> Is it possible to have a drop down list or something that compresses 
> the space taken by that list of values? 
>
> Thanks a lot! 
>
> Julien

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/iPh_aOn2qssJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to