#35602: Allow simple_tag to be defined and used in a for loop
-------------------------------------+-------------------------------------
Reporter: Henrique Lacreta | Owner: (none)
Alves |
Type: New feature | Status: closed
Component: Template system | Version: 4.2
Severity: Normal | Resolution: wontfix
Keywords: tag, simple_tag | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):
* resolution: => wontfix
* status: new => closed
* summary: Fix simple_tag use in for loop => Allow simple_tag to be
defined and used in a for loop
* type: Bug => New feature
Comment:
You're right, given a simple_tag like
{{{#!python
@register.simple_tag(name="iterable")
def iterable(a, b):
return a, b
}}}
You cannot do `{% for object in iterable 1 2 %}{{ object }}{% endfor %}`
but you can do
{{{
{% iterable 1 2 as output %}{% for object in output %}{{ object }}{%
endfor %}
}}}
I would class wanting to avoid using "as" to be a new feature request and
if this is something you feel strongly about, you can discuss this on the
[
https://forum.djangoproject.com/c/internals/5 Django forum] and see if
the community agrees with you.
Personally I'm not sure it's worth it
--
Ticket URL: <
https://code.djangoproject.com/ticket/35602#comment:1>
Django <
https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.