[Answered ]-Django return home page in get absolute url

1👍

You need to redirect to the view with the given name, so:

redirect('blog-home')  # since name='blog-home'

or if you work with a class-based view which has a FormMixin like a CreateView, UpdateView, etc. you reverse with:

from django.urls import reverse

class PostCreateView(CreateView):
    # …

    def get_success_url(self):
        return reverse('blog-home')

Leave a comment