0

I upgraded my django project from 1.4 to 1.5 and now I'm getting the error that my url tags are formatted incorrectly. I did some research to find that, I believe, all my url tags are now in the wrong format.

In 1.4, my url tags looked like this: {% url path.to.view %} In 1.5 the url tag must look like this: {% url 'path.to.view' %} (note the single quotes)

Am I reading this correctly? All url tags need single quotes around the path to the view? Isn't that a huge inconvenience since people upgrading will have to change every single url in their templates to add single quotes? Is there a quicker way to deal with this? I have a lot of templates (it's a large corporate web application).

Thanks

Garfonzo
  • 3,876
  • 6
  • 43
  • 78
  • Unfortunately, you have to deal with it. If you were to go through the pain, I would recommend you consider 1.6 (latest stable release), as there are more significant changes. – karthikr Aug 27 '14 at 18:02

1 Answers1

1

Yes, you are reading it correctly. The change is covered in the release notes

The change might be inconvenient, but it makes the url tag consistent with others, and allows you to use variables as well as strings as tag arguments. There was an option to use the new style tag in Django 1.3 and 1.4 to allow users to prepare for the change.

Alasdair
  • 298,606
  • 55
  • 578
  • 516