Django 1.7 fixes

Some things to make it work with Django 1.7.

I'm not sure how to best make it work with pre-1.7 versions at the same time, so... don't merge this since it will break < 1.7. Maybe you have an idea for what to do (start a 1.7 branch?).