Fix python 2.6 and django 1.4 issues in tests