revised core/views.py