Safely check for settings.HAYSTACK_SEARCH and small PEP 8 improvements.
Merge branch 'master' of https://github.com/GeoNode/geonode