mptt with count of a different models instances that have tree model as foreignkey
问题 In an online shop I use django-mptt for product categories with several levels. I also have products that each belong to a category. Now I'd like to visualise the category tree like this: all(18) - edible (10) -- food (4) -- drink (6) - inedible (8) -- wood (3) -- rock (5) where the numbers in scopes are the product counts for each category. I am able to visualize the category tree. I can also place the product count behind the category names, but the way I am doing it seems very inefficient.