Django - counting 'depth' of 'select_related' to get know how many nodes has object to top object -


for example if have model class this:

class category(models.model)     parent = models.manytomanyfield('self', symmetrical=false, blank=true) 

and have instance of category have parent parent has albo has parent, there possibility value of children instance top category? , there possibility count somehow depth of deepest related object of of category instance?

if need trees of model instances, take @ django-mptt or django-treebeard. both provide lot of convenience.


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -