Using django-mptt to get only the categories that have items -
sample structure: all uppercase: category mixed case: item root ├── books │ ├── fiction │ │ └── classics │ └── non-fiction ├── clothing └── electronics ├── laptops ├── phones │ ├── apple │ │ ├── iphone 6 │ │ ├── iphone 6 plus │ │ ├── iphone 6s │ │ └── iphone 6s plus │ ├── motorola │ │ ├── moto g4 │ │ ├── moto g4 play │ │ ├── moto g4 plus │ │ └── moto x │ └── samsung └── tablets └── apple i'm trying have index page show "electronics" category. "clothing" category shouldn't show since it's empty , "books" category shouldn't show either since, although has child categories, child categories don't have items. similarly, "electronics" page should show "phones" category. "laptops" category shouldn't show since it's empty , "tablets" category shouldn't show either since...


Comments
Post a Comment