first set of refactors for django 1.6 compatibility