Re: Template Tag Not Reinitialized in Loop

2010-05-12 Thread Benjamin Wohlwend
Hi, On Wed, May 12, 2010 at 5:28 PM, subs...@gmail.com wrote: > What is the simple workaround that I'm missing? > > -Steve > in a nutshell, you save the name of the variable on initialization of the node and resolve it while rendering. See all the examples in django/template/defaulttags.py, e.h.

Re: Template Tag Not Reinitialized in Loop

2010-05-12 Thread subs...@gmail.com
I recently ran into this problem too for the first time. Essentially this boils down to my not being able to use a templatetag in a loop in some cases. What is the simple workaround that I'm missing? -Steve On May 5, 2:12 pm, Apreche wrote: > I had a really strange bug in one of my custom templa

Re: Template Tag Not Reinitialized in Loop

2010-05-11 Thread burc...@gmail.com
I bet context['page'] is different each time, but the tag initialization is called only once. So it's probably your programming error, not a bug in django. On Tue, May 11, 2010 at 1:29 AM, patrick91 wrote: > I've this problem too > > I created a custom template tag that renders info about a model

Re: Template Tag Not Reinitialized in Loop

2010-05-10 Thread patrick91
I've this problem too I created a custom template tag that renders info about a model but when I use that tag in a for the tag is used just one time. Like this {% for page in pages %} {% show_info page %} {% endfor %} --- page info #1 page info #1 page info #1 should I provide my custom t

Re: Template Tag Not Reinitialized in Loop

2010-05-05 Thread Alex Gaynor
On Wed, May 5, 2010 at 4:27 PM, Apreche wrote: > Well, I think my suggestion is obviously that when a template tag is > in a loop, it should be re-initiated on every iteration, since that > would avoid unexpected and non-obvious side effects. > > -Scott > > On May 5, 2:52 pm, "burc...@gmail.com"

Re: Template Tag Not Reinitialized in Loop

2010-05-05 Thread Apreche
Well, I think my suggestion is obviously that when a template tag is in a loop, it should be re-initiated on every iteration, since that would avoid unexpected and non-obvious side effects. -Scott On May 5, 2:52 pm, "burc...@gmail.com" wrote: > Hi Apreche, > > I don't want to be rude, but you pr

Re: Template Tag Not Reinitialized in Loop

2010-05-05 Thread burc...@gmail.com
Hi Apreche, I don't want to be rude, but you probably wanted to send this to django-users, it is the place full of users of django framework who should be aware of your problem and this point of confusion (hm, or should it be blog post so everyone can google on their problem and find your message?

Template Tag Not Reinitialized in Loop

2010-05-05 Thread Apreche
I had a really strange bug in one of my custom template tags today. It took me the entire morning to figure it out, but I finally did. I'm not sure if it's a bug or a feature, but I wanted to make a post to help the next person who has this same problem. Let's pretend you make a custom template ta