used code from exercise for views.py