Add some magic to view.py code