Added backwards compatibility for Django 1.6