Add support for Django 1.5

This fixes two problems with Django 1.5. and should be backward compatible.

A new release for Django 1.5 would be nice.