Some changes to upgrade to Django-1.4