Django 1.7 compatibility fixes.

Branch created from #154 and #155 suggestions.
The aim is to be ready for Django 1.7 release next week.