Some changes required for migration to Django 1.5.