当前位置: 动力学知识库 > 问答 > 编程问答 >

how to get argument in dictionary in django template?

问题描述:

i need to pass from view to view using Balise in django template, so i have a dictionary contained my arguments

this the code i used in my template

{% for item in data % }

{% for key, value in item.items %}

{% if key == '13' %}<a href="{% url hisaccount value %}">{% endif %}<p>go to view</p></a>

{% endfor %}

{% endfor %}

but i get this error :

NoReverseMatch at /filter/

Reverse for '' with arguments '(1,)' and keyword arguments '{}' not found.

any suggestion ?

网友答案:

I needed to do something similar. After some digging, it looks like its not built in as a default Django template tag.

You need to build your own, I used this one that I've found on stackoverflow: Django template how to lookup a dictionary value with a variable

分享给朋友:
您可能感兴趣的文章:
随机阅读: