我使用Django 1.11編程,現在我已經按照post_list.html無法解析餘數:從 '{{request.LANGUAGE_CODE}}' '{{request.LANGUAGE_CODE}}'
{% with lang={{request.LANGUAGE_CODE}} %}
{% endwith %}
<p>
{% if lang == 'zh-CN' %} {{object.category.name_zh_CN}} {% else %} {{object.category.name}} {% endif %}
</p>
但我不能得到朗實際上與以下錯誤信息,請help.Thanks。謝謝。
TemplateSyntaxError at /adv/australia-strategic/
Could not parse the remainder: '{{request.LANGUAGE_CODE}}' from '{{request.LANGUAGE_CODE}}'
Request Method: \t GET
Request URL: \t http://localhost:8030/adv/australia-strategic/
Django Version: \t 1.11.6
Exception Type: \t TemplateSyntaxError
Exception Value: \t
Could not parse the remainder: '{{request.LANGUAGE_CODE}}' from '{{request.LANGUAGE_CODE}}'
Exception Location: \t /Users/wzy/anaconda2/envs/python36/lib/python3.6/site-packages/django/template/base.py in __init__, line 700
Python Executable: \t /Users/wzy/anaconda2/envs/python36/bin/python
Python Version: \t 3.6.3
Python Path: \t
['/Users/wzy/expo3/expo',
'/Users/wzy/anaconda2/envs/python36/lib/python36.zip',
'/Users/wzy/anaconda2/envs/python36/lib/python3.6',
'/Users/wzy/anaconda2/envs/python36/lib/python3.6/lib-dynload',
'/Users/wzy/anaconda2/envs/python36/lib/python3.6/site-packages',
'/Users/wzy/expo3/expo']
'lang' VAR不會制定出'with' templatetag範圍 –
感謝我完全固定你的好心幫助這個問題。 –