Django的include语句表现奇怪

时间:2018-08-18 22:12:55

标签: django django-templates

以下代码运行正常,但最近在服务器上显示为奇怪。

views.py

context['data'] = [{'personal_email': 'personal_email@gmail.com', 'office_email': 'office_email@gmail.com'}]

模板

{% for i in  data %}
{{ i.personal_email }}
{{ i.office_email }}
{% include 'sample.html' with email=i.personal_email %}
{% include 'sample.html' with email=i.office_email %}
{% endfor %}

我无法在sample.html文件中获得office_email

0 个答案:

没有答案