Reputation: 1507
I have a form that a user fills and then clicks a button to submit, then it calls a transition page, to inform the user that the form was completed. The user can click a button to go back to the home page from the transition page.
I want to get rid of the transition page and go to the home page directly. The reverse function does not change the URL but renders the correct homepage template. However, the context data in the template does not get populated and I am assuming that the URL not changing causes that.
The homepage urls.py
I include:
url(r'^(?P<user_id>\d+)/$', views.UserHomePageView.as_view() ,
name='user-homepage'),
Example: the form URL is
localhost:8000/form/15/fill
After the form is submitted, I want it to redirect to
localhost:8000/home/3
from the view after form submission, I call
return HttpResponseRedirect(reverse('homepage:user-homepage', args=[userid]))
Upvotes: 0
Views: 865