Improve Django 1.5 support and applied several pep8 updates