Fix backwards compatibility to Django<1.6