Fix django 17

Django 1.7 fixes, and other things.

Let me know if you don't want to pull all of them, I can separate out the fixes.