python - Django: Best way for simple hierarchy? -
i have model:
class category(models.model): name = models.charfield() description = models.charfield(blank=true) parent = models.foreignkey('self', blank=true, null=true)
i want django sort categories respect hierarchy, example:
- parent 1
- child 1
- parent 2
- child 1
i did research , found 2 apps, treebeard.al_tree , django mptt, both powerful may lead lower performance or harder maintain.
i display categories in website's sidebar , inside admin pages (includes foreignkey in posts model), there low additions/modifications/deletions categories, reading should have no big affect on performance.
is there other app offers , simpler above? can achieve using django without additional apps, using managers or else?
i not see disadvantes using app django-mptt. in fact methods provided optimized give maximum in performance when doing queries hierarchical structures. no reason me worry maintainability and/or performance , quite easy use!
Comments
Post a Comment