所以在我的template
,我有以下代码:
<span class="state-txt">{{ state }}</span>
在我views.py
的 中,它使用以下 if/else 循环处理:
if user is not None:
if user.is_active:
login(request, user)
state = "You're successfully logged in!"
return render_to_response('uc/portal/index.html', {'state':state, 'username':username}, context_instance=RequestContext(request))
else:
state = "Your account is not active, please contact UC admin."
else:
state = "Your username and/or password were incorrect."
本质上,它目前工作正常,但我希望每个标签state
都能够包含不同的 < img
> 标签,但是当我只键入state = "<img src="some.jpg"> Your username and/or password were incorrect."
html 时无法正确呈现。有什么方法可以做我想要在 Django 中做的事情,还是我在叫错树?