Skip to main content

Upgrading from Django 1.4 to Django 1.5

March 25, 2013

Recently I had the pleasure of upgrading from Django 1.4 to Django 1.5. They've introduced some awesome new stuff like beefier timezone support and a configurable User model. However, there are some backwards-incompatible things you'll need to tend to.

Django settings

I ran into an issue with some app complaining about not being able to work with naive timezones. You'll need to add this to your

USE_TZ = True

Tag changes

The URL tag has changed to take a path to a view function as a string. Previously this wasn't stringified.

{% url whatever args %} -> {% url 'whatever' args %}


The old direct_to_template generic view has been changed to a more traditional class. Here's the new structure:

from django.views.generic import TemplateView
url(r'^500/$', TemplateView.as_view(template_name='500.html')),


The quite-popular django-registration app took some time to get proper 1.5 support, but the awesome Mr. Bennett was able to get support rolling during a PyCon sprint. You should Gittip him.

Primarily, django-registration has been rewritten to use class-based views. If you had a custom form you were passing to your registration app, you'll need to do some things.

On Snipt I use a custom registration form that further restricts characters in usernames, as well as forces uniqueness of email site-wide. Here's what you need to do to get 1.5 support from django-registration with custom forms:

  1. First off, make sure you're using the django-registration from Bitbucket, not pip. It should land on pip soon, but for now do this. When you install it, you must also have Django installed first. I have no idea why this is the case.
  2. Second, set up your custom registration_register URL.
  3. Create your custom registration form.
  4. Create your custom registration view and point it to the form.
  5. Make sure your custom registration view sub classes the RegistrationView from registration.backends.default.views.


This may or may not be 1.5-specific, but you need to make sure your index_queryset is accepting **kwargs, like this.


This was fun. Both of these pyelasticsearch repos will fail in 1.5:

You need to specifically install version 0.3 from pip.