Fixes to support Django 1.6