optimized views.py