Modified graph view in views.py