Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django 1.5. 'url' requires a non-empty first argument. The syntax changed in Django 1.5

Tags:

django

If I try:

href="{% url post_content product_id=p.id %}"

I have this error:

'url' requires a non-empty first argument. The syntax changed in Django 1.5, see the docs.

How to change it?

like image 308
mamasi Avatar asked Mar 07 '13 12:03

mamasi


1 Answers

Changed in Django 1.5: The first parameter used not to be quoted, which was inconsistent with other template tags. Since Django 1.5, it is evaluated according to the usual rules: it can be a quoted string or a variable that will be looked up in the context.

So: "{% url 'post_content' product_id=p.id %}".

like image 58
Adrián Avatar answered Nov 09 '22 01:11

Adrián