On Mon, 2006-10-02 at 19:34 -0700, carlwenrich wrote: > How do I pass those (global) values from one view to another when going > through a template?
You could put the information in the user's session (see [1]). You can store pretty much anything you like a session object, so if you want certain pieces of information to follow the user around between views, that is a good place for them. This information is stored in the database to keep it persistent, but in Python code it behaves like a dictionary. [1] http://www.djangoproject.com/documentation/sessions/ The problem with your globals approach is when more than one user accesses the pages. Imagine the following timeline: T0: User A accesses the first view and some globals are set. T1: User B accesses the first view and the same globals are set to different values. T2: User A now finishes with the second page and the view that handles that tries to use the globals. These globals are set to User B's value, but you have no way of knowing that. This is the simplest case. More complex problems are obviously possible, too. Essentially, you have no way of controlling the order of requests or ascertaining that all the views come from the same person, etc. It may not even be the same process handling successive view requests (for example, what if the server did a routine restart in between). If you want per-user persistent data, tie it to the user (session). Hope that clears up some of the confusion. Regards, Malcolm --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

