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

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -