Fixes to work with Django 1.5, passes all tests