I have some template code which looks something like this:
{% if condition %}
{% get_latest parameter1 %} - foo
{% else %}
{% get_latest parameter2 %} - bar
{% endif %}

get_latest is a custom template tag, and I noticed that in my
debugging output it is being run both times - ie with parameter1 and
parameter2. Since it hits the database I'd rather not have it do
this.

On the other hand only foo or bar appears in the rendered page. I
guess the template system renders all the tags, then discards
whichever branch does not apply.

So the question is, can I avoid this? Or should I just change my
template tag so I can call it with:
{% get_latest condition parameter1 parameter2 %}

Thanks,

Pete

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to