I wrote a custom tag that allows you to cache an expression in a
template.

I noticed, that my template was sending many duplicate queries to the
database because I was using a method in my model that used a foreign
key in a loop with many repeats.

I could have recoded the view to generate all the required data before
rendering the template, but chose to implement a caching mechanism for
the template instead.

There seem to be pros and cons to both approaches.

More details here: http://django.satilla.com/board/topic/2/

Reply via email to