Support for Django 1.7
Further changes to make it compatible with Django 1.7