Migrate URL Tags to Django 1.5

Prior to Django 1.3, the syntax for the url tag was {% url app-view %}. Django considered the first variable in the URL tag to be a special case unquoted constant instead of a context variable named app-view.

In Django 1.5 this functionality was reversed so that an unquoted first argument to the URL tag is considered a context variable. So, when I recently upgraded Brite Revolution, Brite Me, and Brite for Brands to Django 1.5 I received a Deprecation Warning about my legacy use of the URL template tag. I needed to convert all of my existing URL tags (over 200 instances) to use quoted literals as the first argument.

Thankfully, PyCharm 3’s “Replace in Path” with a regular expression made quick work of this for me:

PyCharm 3 "Replace in Path" example
PyCharm 3 “Replace in Path” example

More info on the URL template tag can be found in the Django docs.