Saturday, August 28, 2010

Re: How to store and retrieve objects to/from session?

Have you tried to just dump the object into the session?

On Aug 28, 2010 12:41 PM, "Andy" <selforganized@gmail.com> wrote:
> I know I can store simple key/value pairs to session. Is it possible
> to store entire objects to session?
>
> I want to enable un-logged-in users to submit form data. After the
> form is submitted, I want to store the form data in session and then
> redirect the user to sign-in. After they sign in, I'd retrieve the
> stored form data from session and save it to database.
>
> For example:
>
> if request.method == 'POST':
> form_object = CommentForm(request.POST)
>
> Now if the user is not signed in, I want to save form_object to
> session, and later retrieve it from session after the user has signed
> in.
>
> Is there a way to save entire objects to session?
>
> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
>

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment