Odd Django Problem
In my views I want to pas开发者_如何学JAVAs in an error condition.
def something(request):
name = request.GET.get('name')
if name is None:
return render_to_response('myapp.html', {'invalid': 'true'})
Then in my template I want to display different things depending on this.
So I do:
{% if invalid %}
INVALID
{% else %}
ALL OK
{% endif %}
However, the output is:
INVALID
ALL OK
It shows both things - can anyone suggest any reason. Probably somethingstupid I did. But driving me mad.
{'invalid': True}
maybe it's because of that..
精彩评论