Updated for newer django.