in my views.py i obtain 5 dicts, which all are something like {date:value} all 5 dicts have the same length and in my template i want to obtain some urls based on these dicts, with the common field being the date - as you would do in an sql query when joining 5 tables based on a common column
在座各位想:
for key, value in loc.items():
print key, loc[key], ctg[key], sctg[key], title[key], id[key]
但是,在干jan的模板中,可以做到的是:
{% for lock, locv in loc.items %}
{% for ctgk, ctgv in ctg.items %}
{% for subctgk, subctgv in subctg.items %}
{% for titlek, titlev in titlu.items %}
{% for idk, idv in id.items %}
{% ifequal lock ctgk %}
{% ifequal ctgk subctgk %}
{% ifequal subctgk titlek %}
{% ifequal titlek idk %}
<br />{{ lock|date:"d b H:i" }} - {{ locv }} - {{ ctgv }} - {{ subctgv }} - {{ titlev }} - {{idv }}
.... {% endifequals & endfors %}
当然,哪一个时候了,需要很多时间才能作出。
现在,我正在研究如何建立一个习俗标签,但我不知道你们是否对这个议题有任何反馈?