> > ########### > # template code - I removed the blank lines and reduced the indentation > for readability in an email. > ########### > > {% for categ in categs %} > {% with currscat=categ.souscategorie_set.all %} > <li class = "{% if currscat %} has_menu {% endif %}"> {{categ.nom}} > {% if currscat %} # This line hit database >
Sorry, I was re-reading the answer and thought I removed all of the comments about hitting the database from your template code. This is the original comment you put in, not one I inserted. I don't believe the template will incur any further database hits if the pre-fetching works. -James -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2Be%2BciUp7z3Xd64xd%2BWhAwVS3jdh07_WbWiiDKsP-vjhA4nEaQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.