Imagine you have a template which has a button that by clicking on it, you will will be redirected to another template to choose an item and then come back to previous template. Something like this scheme :
(Template 1)
|
|
|
*------------------ > (Template 2, with some items)
|
|
|
(Select an Item)
|
|
<---------------------*
|
|
(Template 1 , again)
But when I redirect to my previous template, it seems that I lost all of my items that I filled-in before. I just need to override one part in original template and not all of it.
Needless to say, I have two view functions: One that creates Template-1 and another one for passing the selected item to the original template !!
You can’t be directed to another template, you can only be directed to another view. (A template is pretty much irrelevant to the whole request/response cycle; it’s just one of the ways that Django can produce a response, but isn’t a necessary part of it and can even be used outside it, for example in sending emails.)
The way to preserve state between views is to use sessions.