# stay on same page you're currently on after form submission from django.http import HttpResponseRedirect def yourView(request): if request.method == 'POST': # Your model and form save code here return redirect(request.META.get('HTTP_REFERER', 'index')) return HttpResponseRedirect(request.path_info)
Here is what the above code is Doing:
1. If the request is a POST request, it will save the form data and redirect to the same page.
2. If the request is not a POST request, it will redirect to the same page.