Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I applied the fixes in the stackoverflow link:

<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 error. Where am I wrong?

UPDATE:


Django 1.5

Python 2.7.2

{% url shop_index %} gives error. If I use {% url 'shop_index' %}, it is ok.


Django 1.5.dev17865

Python 2.7.3

{% url 'shop_index' %} gives error. If I use {% url shop_index %}, it is ok.


It is very strange.

like image 721
Burak Avatar asked Jul 08 '12 13:07

Burak


1 Answers

Try putting shop_index in quotes:

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

Without the quotations, shop_index will be treated like a template variable instead of a string.

like image 82
Timmy O'Mahony Avatar answered Oct 05 '22 22:10

Timmy O'Mahony