python - Django Admin Filter by Related Field Count -
i using django 1.27 have 2 models
class publisher(models.model): name = models.charfield(max_length=100) def book_count(self) return self.book_set.all().count() class book(models.model): publisher = models.foreignkey(publisher)
and in publisther admin want able filter book count
class publistheradmin(admin.modeladmin): list_filter = ('book_count') ....
how can work ?
Comments
Post a Comment