Last Updated: December 30, 2020
· dizpers

Django 1.5: 'url' requires a non-empty first argument. The syntax changed in Django 1.5

Problem was in code like that:

{% url books.views.books_list somevar %}

To solve this problem you should do like that:

{% url "books.views.books_list" somevar %}

How to automate solution

You can use this in console:

WARNING: be sure, that you execute this in template folder of your project!

find . -type f -print0 | xargs -0 sed -i 's/ url \([^" >][^ >]*\)/ url "\1"/g'

automated solution taken fomr this SO answer.