views.py changes to fix errors