Shifting to “new-style” url tag in Django 1.5

Prior to Django 1.3, the syntax for the url tag was {% url project_create %}. Django considered project_create to be a name of a view in your, not a template variable named project_create.

I recently upgraded Blimp from Django 1.4.5 to Django 1.5.1. We have around 200+ template files that were using the old url tag syntax and there was no way I was going to add quotes around the view names one by one.

I used Sublime Text 2’s Find and Replace with some regex to get the work done.


This will search all files in a project for content that matches % url somethinghere and add single quotes around somethinghere.



Check out Django 1.5 release notes.