Login

Snippets by Craterdome

Snippet List

Upgrade django url tags

In Django 1.5 url tags require you to pass in the name of the url as a string. So where you used to be able to do this {% url home_page %} you now have to do this {% url 'home_page' %} Upgrading an old project can be a pain, so here is a snippet for a py file that will update all your url tags. Just put it in a py file in your root directory and execute it. The error you get otherwise is: 'url' requires a non-empty first argument. The syntax changed in Django 1.5, see the docs.

  • tag
  • url
  • upgrade
Read More

Craterdome has posted 1 snippet.