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

actionscript 3 - TweenLite does not work with object -

php - How can I edit my code to echo the data of child's element where my search term was found in, in XMLReader? -

c# - Global Variables vs. ASP.NET Session State -