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

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -