Hello,
In my recent project I have been finding myself wishing that the {%
ifequal %} tag had support for AND OR.  I posted a <a
href="http://code.djangoproject.com/ticket/1209"/>patch to ticket
1209</a> that does just this.  I was hoping to start a bit of
conversation here to see if others thought this might be useful.

The syntax is as follows:
{% ifequal fname "Jay" OR fname "James" %}
    The name is Jay or James
{% else %}
    The name is not Jay or James
{% endifequal %}

{% ifequal fname "Jay" AND lname "Johnson" %}
    The name is Jay Johnson
{% else %}
    The name is not Jay Johnson
{% endifequal %}

The patch includes tests to the tests/othertests/templates.py that has
convinced me (so far) that this does not break any existing use of {%
ifequal %}.

What do you think?

Reply via email to