Django admin list filter

django, django-admin, django-models

Solution

See this SO thread. It's not as easy as it feels like it should be.

Problem

I want to add a custom model method to the admin filter, however it fails. Example Foo: ``` class Foo(models.Model): number = models.IntegerField() def big_enough(self): return self.number > 99 ``` now at the admin panel: ``` class FooAdmin(admin.ModelAdmin): list_filter = ('number', 'big_enough') ``` Fails, I get the error ImproperlyConfigured at /admin/test/foo/ 'FooAdmin.list_filter[0]' refers to field 'big_enough' that is missing from model 'Foo'.

Original source

Related problems