Refactor quiz template and views.py