fixes python 3.2 compat
apply some pep8 rules
django 1.7 compatibility
fixes django 1.7 compatibility