2010-05-20 63 views

回答

3

爲什麼你想在這裏使用模板標籤?模板標籤用於模板。如果您想查找反向URL,請使用reverse函數。

0

第一:不要這樣做!將HTML代碼放在模板中。

二:除非您將它們在你的模板是安全的,你也許能

from django.template import Context, Template 
t = Template(u"Your profile is not.... {% url blah %} ...") 
raise ValidationError(t.render(Context()) 

但是HTML代碼來做到這一點會被轉義。

+0

首先聲明是健全的。但我該怎麼做?也許通過設置特殊的表單屬性? – 2010-05-20 14:21:08

+0

在顯示錶單之前,您是否可以檢查配置文件激活? 類似於你的觀點:如果request.method ==「GET」而不是profile.activated():redirect_to_url_describing_problem – mawimawi 2010-05-20 15:16:30

相關問題