Fixes incompatibilities with django 1.6.5.