On Friday, 29 June 2012 15:45:16 UTC+1, ivanb wrote: > > 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. > > Thanks >
Use the messages framework to add a message to the user when you process, and display it on the page you redirect to. https://docs.djangoproject.com/en/1.4/ref/contrib/messages/ -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/Xxcva4kZ7twJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.