[Answered ]-Django submit a form->redirect to a new page->auto update new page

2πŸ‘

βœ…

In your views.py, HttpResponseRedirect is used incorrectly. If you want to redirect to a new page, then you should use,

return HttpResponseRedirect('/url-where-you-want-to-redirect/')

As HttpResponseRedirect expects url paramter instead of template name.

See here: https://docs.djangoproject.com/en/1.9/ref/request-response/#django.http.HttpResponseRedirect

Better approach would be to return a JSON response from your status_page view and then in success method of ajax, you can go to next URL:

window.location.href = '/url-where-you-want-to-redirect/';

I hope this helps.

πŸ‘€Aakash Rayate

Leave a comment