On a model admin object I have a callable function, that returns either True or False. I want to be able to use this callable to filter what is displayed in the list (i.e. list_filter). However the below code wouldn't work, because you can only use list_filter on fields:
...
class FooAdmin(admin.ModelAdmin):
...
list_filter['bar']
def bar(self, obj):
x = ... #something boolean
return x
...
Is there any way to use a True/False callable to filter a list in admin? Or do you have to denormalize your data if you want this functionality?
I notice that in the development docs, this is now possible: https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_filter
However in the 1.3 docs (the Django version I'm using) it does not mention of this: https://docs.djangoproject.com/en/1.3/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_filter So I'm assuming I can't use the new functionality with my project :-(