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 changed in Django 1.5, see the docs.

How to change it?

mamasi
  • 915
  • 3
  • 10
  • 17
  • If you need to support Django 1.3 and 1.5 have a lok at this answer: http://stackoverflow.com/questions/14882491/django-release-1-5-url-requires-a-non-empty-first-argument-the-syntax-change – guettli Aug 13 '13 at 11:03

1 Answers1

9

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 %}".

Adrián
  • 6,135
  • 1
  • 27
  • 49