Django tutorial part 4 routing issue

At first glance everything seems to work until I vote. Then instead of going to http://localhost:8000/polls/1/results/ it stays on http://localhost:8000/polls/1/vote/ and the only thing displayed in the browser (both firefox and chrome do this) is /polls/1/results/. My view and url code for results and vote will be posted below. Does anyone know what could cause this ?

views

#question id of results
def results(request, question_id):
   question = get_object_or_404(Question, pk=question_id)
   return render(request, "polls/results.html", {"question": question})

#what question are you voting on?
def vote(request, question_id):
    question = get_object_or_404(Question, pk=question_id)
    try:
        selected_choice = question.choice_set.get(pk=request.POST["choice"])
    except (KeyError, Choice.DoesNotExist):
        # Redisplay the question voting form
        return render(
            request,
            "polls/detail.html",
            {
                "question": question,
                "error_message": "You didn't select a choice.",
            },
        )
    else:
        selected_choice.votes = F("votes") + 1
        selected_choice.save()
    return HttpResponse(reverse("polls:results", args=(question.id,)))

urls

#ex: /polls/5/results/
path("<int:question_id>/results/", views.results, name="results"),
#ex: /poll/5/vote/
path("<int:question_id>/vote/", views.vote, name="vote"),

any help would be greatly appreciated

Welcome @yehochanan !

Your vote method does not match what the tutorial shows you.

Check your code carefully with what’s in the tutorial.

It took me a moment. I didn’t realize that I had missed Redirect. Thank you

I’m trying to follow Amend views in part 4 and everything seems to work except the polls homepage show No polls are available.

urls

from django.urls import path

from . import views

app_name = "polls"
urlpatterns = [
    #ex: /polls/
    path("", views.IndexView.as_view(), name="index"),
    #ex: /polls/5/
    path("<int:pk>/", views.DetailView.as_view(), name="detail"),
    #ex: /polls/5/results/
    path("<int:pk>/results/", views.ResultsView.as_view(), name="results"),
    #ex: /poll/5/vote/
    path("<int:question_id>/vote/", views.vote, name="vote"),
]

views

#latest question
class IndexView(generic.ListView):
    template_name = "polls/index.html"
    context_object_name = "lastest_question_list"

    def get_queryset(self):
        return Question.objects.order_by("-pub_date")[:5]

#test if question exist
class DetailView(generic.DetailView):
    model = Question
    template_name = "polls/detail.html"

#question id of results
class ResultsView(generic.DetailView):
    model = Question
    template_name = "polls/results.html"

Never mind. I found the problem