Answer the question
In order to leave comments, you need to log in
How to loop with url in django and jinja?
In the application, in the urls.py file, I have app_name='women'
How can I display links to the desired name in the loop, since I wrote an error:
Reverse for 'm.url_name' not found. 'm.url_name' is not a valid view function or pattern name.
{% for m in menu %}
{% if not forloop.last %}
<li><a href="{% url 'women:m.url_name' %}">{{m.title}}</a></li>
{% else %}
<li class="last"><a href="{% url 'women:m.url_name' %}">{{m.title}}</a></li>
{% endif %}
{% endfor %}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question