Django 1.7 compat

The unit tests are failing under Django 1.7, these 2 patches fixes it. I'm using the 2 patches in my Debian package which will be released with the next Debian Jessie. Please let me know quickly if you think what I've done isn't appropriate, because Jessie freezes on the 5th of November.