【发布时间】:2013-07-27 15:58:29
【问题描述】:
我想从两个包含变量值的列表中动态填充模板。
谁能告诉我,我怎么能做到这样:
current_task_resources_types = ["image", "html"]
current_task_resources_names = ["elephant.png", "index.html"]
"task": [
{% for index in current_task_resources.length %}
{"type": "{{ current_task_resources_types.index }}", "url": "{{ current_task_resources_names.index }}"},
{% endfor %}
],
【问题讨论】:
标签: django django-templates python-2.x