Friday, June 29, 2012

Redirect question

I'm still learning django so please forgive if I write anything silly.

On my site I'm having something like: on url mysite/list/ I have list of something. On it I have link that leads to another view if you want to add new element to it let's say: mysite/list/add_item/ 

On that url I have form with some information that needs to be written and a file upload in the form. On form submit it actually goes to new view mysite/list/adding/ and there the needed work is done.

After the work is done I want to go back to the first url and view  mentioned. Thing is I would also like it to show a message up there about status of what happened, so I can't use redirect, and if I put render_to_response it actually shows the proper view with the appropriate message but url is not the right one, it keeps the mysite/list/adding/ (that is logical behaviour and I understand it) but I want mysite/list/.

I'm asking for a way to achieve this, do some work and redirect to some previous view with some context added. Also I would like you to point out if I did something here that could have been done in better way so I can do it right and learn for the future.

Also, I know it could be done with setting some get parameters for the redirect but I would like to keep the url clean if possible.

If you know please advise.


You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

No comments:

Post a Comment