On Feb 17, 2007, at 4:58 PM, Honza Král wrote:

> On 2/17/07, oggie rob <[EMAIL PROTECTED]> wrote:
>>
>>> I find it useful to have the {% for %} tag syntax extended so  
>>> that one can write:
>>> {% for a,b in L %} meaning the obvious thing
>
> +1
>
>>
>> You can do this. a,b return type is implicitly (a,b) in Python. In
>> other words:
>> {% for x in L %}
>>  {{ x.0 }}
>>  {{ x.1 }}
>> {% endfor %}
>
> well yes, but you have to admit that
> {% for name, description in list %}
>  {{ name }} - {{ description }}
> {% endfor %}
> looks way better ;)
> just some syntax sugar, but I think it's actually useful

If you change the tuples into dictionaries in the view, you can get  
the same kind of clarity (and that's what I find myself doing quite a  
bit, actually):

{% for x in L %}
    {{ x.name }}
    {{ x.description }}
{% endfor %}

Todd
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to