Fix some side-effects in test. Add Django < 1.6 compatibility in test.