Adding code to support Django 1.6