Fix compatibility problems with django.