List Info

Thread: Store a class in django session object




Store a class in django session object
user name
2007-12-20 02:03:29
Hi all,

is there something to bear in mind, if i store a instance of
a class
in a django session? e.g. there is a class product and i
want to ....
request.session['CURRENT_PRODUCT'] = myproduct

As far as i know, this should be allowed. Isn't it?

Greets,
Dan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Store a class in django session object
user name
2007-12-20 02:08:40
You can't do this because a model instance isn't pickleable.
You can
save the product id instead.

This is documented under:
http://www.djangoproject.com/documentation
/sessions/#technical-details


On Dec 20, 2007 4:03 PM, Daniel Austria <futurebasegmx.at> wrote:
>
> Hi all,
>
> is there something to bear in mind, if i store a
instance of a class
> in a django session? e.g. there is a class product and
i want to ....
> request.session['CURRENT_PRODUCT'] = myproduct
>
> As far as i know, this should be allowed. Isn't it?
>
> Greets,
> Dan
> >
>

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


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )