Answers for "how to redirect to get after post in django"

0

redirect a post request django

def redirected_view(request):
    # Some processing if needed
    ...
    # save post data to session & redirect
    request.session['_post_data'] = request.POST
    return HttpResponseRedirect('redirect_to_view')

def redirect_to_view(request):
    old_post = request.session.get('_post_data')
    # Use saved _post_data & delete it
Posted by: Guest on February-13-2021

Code answers related to "how to redirect to get after post in django"

Python Answers by Framework

Browse Popular Code Answers by Language