calling a view from a view doesnt clear the URL path

22 views
Skip to first unread message

dk

unread,
May 29, 2015, 1:03:17 PM5/29/15
to django...@googlegroups.com
I am doing something like this.

I have my original view that actually gets render as html.
the html have a button that runs another view. with all the logic to process the information. and at the end I want to return to the original view with an extra parameter. just a message saying that was successfully.

everything work perfect,  but the URL path at the top on the browser doesn't reset. still shows all the information that I passed to my second view.   still shows all the variables that I passed from the second url to the view. =( 
is there I way to reset that?





dk

unread,
May 29, 2015, 1:04:50 PM5/29/15
to django...@googlegroups.com
in the second view I am doing at the end.

    return original_view(request, message="successfully")

Daniel Roseman

unread,
May 29, 2015, 2:00:07 PM5/29/15
to django...@googlegroups.com
Why should it? The browser requested the original view, and the code returned a response to that request. The browser doesn't know or care that the process of constructing that response involved calling another view function.

If you want to change the URL, instead of returning the result of another view, you should return a *redirect* to that view.

--
DR.

dk

unread,
May 29, 2015, 2:05:25 PM5/29/15
to django...@googlegroups.com
can I redirect with an argument?

Daniel Roseman

unread,
May 29, 2015, 2:22:40 PM5/29/15
to django...@googlegroups.com
You can redirect with whatever arguments you want, as long as the receiving URL accepts them.

dk

unread,
May 29, 2015, 2:28:27 PM5/29/15
to django...@googlegroups.com
so that redirect needs to be catch by the url,   interesting.
Reply all
Reply to author
Forward
0 new messages