python - Efficient way to generate nested html sitemap in django with lower SQL queries -


it common use recursive method , trivial answer. make queries as count of pages. there way create such html sitemaps lower queries?

def rec_print_childs(page):    print "<ul>"    child in page.childs:  # childs related_name in page module parent field        print "<li>"+child.name        rec_print_childs(child)        print "</li>"    print "</ul>"  rec_print_childs(parent_node) 


Comments