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

If I try:

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

I have this error:

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

How to change it?

+5
source share
1 answer

Changed in Django 1.5: the first parameter that is not used for citation, which was incompatible with other template tags. Starting with Django 1.5, it is evaluated according to the usual rules: it can be a string with quotes or a variable that will be viewed in context.

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

+9
source

All Articles