Im getting strangest error in django so far:
'if' statement improperly formatted
Template that raises the error is this:
{% if diff >= 0 %}
<span class="pos">+{{ diff }}
{% else %}
<span class="neg">-{{ diff }}
{% endif %}
</span>
<span>{{ a }}</span>
view that has a and diff in context is this:
def add(request, kaart_id):
if request.is_ajax() and request.method == 'POST':
x = Kaart.objects.get(id=kaart_id)
x.pos += 1
x.save
x = Kaart.objects.get(id=kaart_id)
from django.utils import simplejson
diff = x.pos - x.neg
a = "(+1)"
context = { 'diff':diff, 'a':a }
return render_to_response('sum.html', context, context_instance=RequestContext(request))
It does not matter what equation i use in if, >, >=, ==.. they all raise the same error.
and as far as i can tell its all by the book: http://docs.djangoproject.com/en/dev/ref/templates/builtins/#id5
Alan.