write the vote() function for views.py