Fixes for Django 1.6

As described in #387, there are problems with Django 1.6
This pull request is resolving those.