Reputation: 1357
I would like to learn how I can use nested template tags where the child template tag takes an argument like below:
{% parent_tag {% child_tag arguments %} rest_of_parent_arguments %}
In the above line, I would like to use the return value of child tag as an argument to the parent tag.
Upvotes: 5
Views: 3066
Reputation: 5198
I would replace the child_tag with a custom filter. Something like:
{% parent_tag argument1|filtername:argument2 rest_of_parent_arguments %}
assuming "arguments" consists of at most 2 arguments. See here for custom filters:
http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#writing-custom-template-filters
Upvotes: 7