2013/6/3 Andre Terra <andrete...@gmail.com>:
> Well, Russ, you asked for suggestions, so here's a couple half-hearted
> attempts.
>
> Perhaps we could allow for if clauses in the with block or vice-versa? It
> could be argued that it would reduce readability and/or induce confusion
> with conditional expressions[0], and I would have to agree.
>
> {% with my_bonnet.bees as bees if my_bonnet.bees %}
> {# could be confused with conditional expressions #}
>     <ul class="bee list">
>     {% for bee in bees %}
>         <li>{{ bee }}</li>
>     {% endfor %}
>     </ul>
> {% else %}
>     <span>No bees!</span>
> {% endwith %}

What about:

{% with nonempty my_bonnet.bees as bees %}
    <ul class="bee list">
    {% for bee in bees %}
        <li>{{ bee }}</li>
    {% endfor %}
    </ul>
{% endwith %}


-- 
Patryk Zawadzki
I solve problems.

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


Reply via email to