refactored views.py, fix bug in utils.js