I tried the above template_tag and it worked fine for me, maybe you're doing something wrong in the template?
My best guess for why "__init__" would be called and not "render" is that the template_tag is not getting rendered due to some other logic in the template. All of these examples below will cause __init__ to be called, but not render for "my_template_tag": 1. Failed if statement: {% if 0 %}{% my_template_tag %}{% endif %} 2. For loop on an empty list (or string): {% for x in "" %}{% my_template_tag %}{% endfor %} 3. Block that gets replaced by a child template: /base.html: {% block test %}{% my_template_tag %}{% endblock %} /my_template.html: {% block test %}OVERWRITE TEST BLOCK!{% endblock %} If that's not the case, then you'll need to provide more information— how's it done in the template? what version of django? etc. Separately, if you're resolving arguments to a template_tag, I'd recommend using the template.Variable and .resolve(context) construct, this will resolve plain text that you put in quotes and also variables that are in the context: http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#passing-template-variables-to-the-tag -- Peter On Sep 11, 10:30 am, eli <eliasz.wont...@gmail.com> wrote: > I have problem when tag is called from for loop in template. It's > called only once (sic!). Why? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---