[PATCH] Django 1.5 compatibility fixes

Ralf Baechle ralf at linux-mips.org
Sat Oct 5 00:03:51 EST 2013

On Fri, Oct 04, 2013 at 02:24:44PM +0800, Jeremy Kerr wrote:

> > Django 1.5 wants plenty of quotes scattered over the templates.
> Looks good, but any ideas if we can get this to work with 1.4? The
> testsuite now seems to barf on not being able to find matching views (as
> it's doing lookups *with* the single quotes)...
> If not, I'll do some digging next week.

The single quotes seem to be what is officially recommended.  There seems
to be a way to make older Django versions require the quotes as well
by doing {% load url from future %}, see also

One deprecated feature worth noting is the shift to “new-style” url tag.
Prior to Django 1.3, syntax like {% url myview %} was interpreted
incorrectly (Django considered "myview" to be a literal name of a view,
not a template variable named myview). Django 1.3 and above introduced
the {% load url from future %} syntax to bring in the corrected behavior
where myview was seen as a variable.

The upshot of this is that if you are not using {% load url from future %}
in your templates, you’ll need to change tags like {% url myview %} to
{% url "myview" %}. If you were using {% load url from future %} you can
simply remove that line under Django 1.5.


More information about the Patchwork mailing list