made changes to work on Django 1.5