imoum
imoum

Reputation: 423

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 ?

Upvotes: 1

Views: 1119

Answers (1)

cjd82187
cjd82187

Reputation: 3593

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 look up a dictionary value with a variable

Upvotes: 1

Related Questions