This works:
{% ifequal test "test" %}
foo...
{% endifequal %}
This not:
{% ifequal test "test 2" %}
foo...
{% endifequal %}
Suggested patch:
django/trunk/django/core/defaulttags.py
===================================================================
--- defaulttags.py (revision 1782)
+++ defaulttags.py (workcopy)
@@ -479,7 +479,16 @@
...
{% endifnotequal %}
"""
- bits = token.contents.split()
+ tmpbits = token.contents.split()
+ bits=[]
+ sep=""
+ for i in tmpbits:
+ if(sep):
+ bits[-1]+=" "+i
+ if(i[-1]==sep):sep=""
+ else:
+ bits.append(i)
+ if(i[0]=="'" or i[0]=='"'):sep=i
if len(bits) != 3:
raise TemplateSyntaxError, "%r takes two arguments" % bits[0]
end_tag = 'end' + bits[0]
I'm afraid this is not an elegant solution. I think it must to be done in other template tags that uses token.contents.split() and are supposed to accept hardcoded strings. I think django/trunk/tests/othertests/templates.py must be also changed.