On Oct 27, 5:35 am, Łukasz Rekucki <lreku...@gmail.com> wrote:
> I would like to bring this up again, because this is something that
> would really improve readability of my templates. I'm mainly
> interested in ticket #7817 (the include tag changes), but extending
> "with" tag (ticket 9456) would keep things consistent.

Here's a link to the ticket for the lazier ones among us:
http://code.djangoproject.com/ticket/7817

The main decision which needs to be made is one of syntax.

The current proposal uses:
{% include "name_snippet.html" with name="Joe" greeting="Hello" %}
but this introduces an inconsistency with the {% with %} tag.

Consistency would be nice, but I think this starts to look a bit
confusing, static tokens outnumbering actual functional ones:
{% include "name_snippet.html" with name as "Joe" and greeting as
"Hello" %}

My proposal is that the current {% with name as "Joe" %} format
becomes the legacy format, and that the new format becomes (also
allowing for multiple arguments):
{% with name="Joe" greeting="Hello" %}

Other tags which currently use the "as" token are: cycle, regroup and
url. These all introduce a new variable into the current context,
which does differ slightly from how {% with %} alters a variable in a
contained scope. So my secondary (perhaps somewhat feeble) argument is
that this actually helps to keep the "as" token's behaviour more
consistent. :)

Thoughts?

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-develop...@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to