开发者

Django: Nested variables in templates

In one of my django login templates, I h开发者_运维技巧ave a line:

<input type="hidden" name="next" value="{{ next|default:'{% url jobseeker_home %}' }}" />

And when I view the source code of the HTML page generated, I get the following for the above template line:

<input type="hidden" name="next" value="{% url jobseeker_home %}" />

Unfortunately, the {% url jobseeker_home %} is not being resolved. How can I solve this?

Thanks


Variables can be declared within a Django template:

{% url jobseeker_home as home_url %}
<input type="hidden" name="next" value="{{ next|default:home_url }}" />
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜