开发者

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..

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜