Django compatibility

This allows the use in django 1.5 and greater. It __should__ not break backwards compatibility, this isn't tested however.