Выбранная опция в просмотре

У меня есть опрос радио чекбоксов, которому я передаю selected_option в представление, когда я сравниваю его со счетчиком цикла, он равен 0 и 0, но говорит, что это false. шаблон:

<label id="poll">
                            <input type="radio" name="poll" value="{{ forloop.counter0}}" required>
                            {{ poll.option }} - {{poll.votes}}
                            </label> &nbsp;

views.py:

selected_option = request.POST['poll']
print(selected_option == i)
if selected_option == i:
       for i, poll in enumerate(polls):
                    if Vote.objects.get(poll=poll,voter=request.user).exists():
                        if poll.votes - 1 < 0:
                            Vote.objects.get(poll=poll ,voter=request.user).delete()     
                            return JsonResponse(poll.votes, safe=False) 

Вернуться на верх