<...">

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

I applied the fixes in stackoverflow:

<a href="{% url shop_index %}"><span>{% trans "Shop List" %}</span></a> 

in urls.py :

 url(r'^shop/$', 'index', name="shop_index"), 

But still the same mistake. Where am I mistaken?

UPDATE:


Django 1.5

Python 2.7.2

{% url shop_index %} gives an error. If I use {% url 'shop_index' %} , that's fine.


Django 1.5.dev17865

Python 2.7.3

{% url 'shop_index' %} gives an error. If I use {% url shop_index %} , that's fine.


It is very strange.

+6
source share
1 answer

Try shop_index :

 <a href="{% url 'shop_index' %}"> 

Without quotes, shop_index will be considered as a template variable instead of a string.

+12
source

Source: https://habr.com/ru/post/919973/


All Articles