Add .idea to .gitignore
Minor refactoring in views.py