On Mon, 2007-10-22 at 13:37 +0000, Rufman wrote: > > > OK, so if you're wanting to change the URL that the client is > > retrieving, you need to use an HTTP redirect (return a > > django.http.HttpResponseRedirect() class from your view). This sends the > > new URL to retrieve back to the client, which then requests the new URL > > and gets the new page. Hopefully your URLs contain enough information on > > their own to describe what data is displayed on the page, because an > > HTTP redirect is just the URL that should be retrieved. > > So this means I cannot pass a context object as well?
That's right. An HTTP redirect is a response that goes all the way back to the client's browser and which they use to make a *new* HTTP request for the information you're redirecting them to. On one level, you could work around this by doing things like storing all the necessary information between the views in the session and then retrieving it on the next call. On another level, though, you might want to rethink what you are wanting to do. If the new URL does not contain sufficient information to correctly identify the new information, why both changing it at all? It's not accurate in either case. This is kind of the main underlying design goal that underlies a lot of the conversations about good URL design and REST interfaces and the like. Even if you don't want to think about it in those terms, at least remember that the URL describes what they (the user) are wanting to retrieve. Either it accurately reflects the information you send them back -- in which case you should absolutely try to keep it in sync with the data and HTTP redirects are your friend -- or it doesn't, in which case what the URL shows is pretty much irrelevant, since it's not like they can bookmark the page or email it to a friend or anything like that. I realise that I'm possibly making your problem harder, rather than just giving an answer. Not my (primary) intention. You can decide to ignore all the "good design" points and just use the session to save state between requests. That's hardly unheard of in the industry. There are problems with it, but it also works for some problems, so just go in being aware of what you are trading away. Regards, Malcolm -- How many of you believe in telekinesis? Raise my hand... http://www.pointy-stick.com/blog/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---

