I want to add a custom model method to the admin filter, however it does not work.
Foo example:
class Foo(models.Model): number = models.IntegerField() def big_enough(self): return self.number > 99
now in the admin panel:
class FooAdmin(admin.ModelAdmin): list_filter = ('number', 'big_enough')
Failure, I get an error
Incorrect Configured in / admin / test / foo / 'FooAdmin.list_filter [0]' refers to the 'big_enough' field that is not in the 'Foo' model.
django django-models django-admin
Hellnar
source share