djangosnippets.org: Latest snippets tagged with '3400'https://djangosnippets.org/tags/3400/2010-02-04T20:18:00.520074-06:00Foreign Key list_filter wthout custom FilterSpec
2010-02-04T20:18:00.520074-06:00haileris23https://djangosnippets.org/snippets/1911/<p>This is some (probably) pretty dodgy code that allows for foreign keys in the admin's list_filter without using a custom FilterSpec. It overrides the django.db.models.options.Options get_field class to handle spanned relationships, i.e. list_filter=('house<strong>room</strong>town',) as seen in http://code.djangoproject.com/ticket/3400
</p>
<p>I have only tested this with a double foreign key relationship('house__room'), …</p>
Freely redistributable