Converted views.py to return json objects.