Thanks for the suggestion, I'm vaguely familiar with lazyness, and I
think at the moment my template tag is actually ok. It just returns a
queryset of the latest objects for a particular model to the context.
I was just surprised to see debugging output from the template tag
when as far as I was
Pete,
I'm not completely familiar with you problem or what exactly
'get_latest' does.
But my intuition is that you may wish to consider rewriting
'get_latest' to be more "lazy"
If it is not exactly clear what I mean by that see Django online docs
on lazy querysets
e.g. http://docs.djangoproject.co
I dont think that helps, but I have just realised when fiddling around
that if both template tags really were being called it would have
raised an error as only one isn't always valid.
The debugging output I was seeing came from the __init__ of my
template tag's Node class. However, the render me
try firstof??
{% firstof var1 var2 var3 %}
This is equivalent to:
{% if var1 %}
{{ var1 }}
{% else %}{% if var2 %}
{{ var2 }}
{% else %}{% if var3 %}
{{ var3 }}
{% endif %}{% endif %}{% endif %}
On Oct 16, 9:49 am, "pjrhar...@gmail.com" wrote:
> I have some template code which looks
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 a
5 matches
Mail list logo