please have a look at this section
http://docs.djangoproject.com/en/dev/topics/http/sessions/#when-sessions-are-saved

--rama

On Jul 2, 2:15 am, bjoern_mainz <bjoern.ma...@googlemail.com> wrote:
> Hi,
>
> what i try do do is (in plain python):
>
> products = []
> products.append({"product" : "foo","quantity": 5})
> products.append({"product": "foz","quantity": 1})
>
> -------Django-------
>
> def add_to_basket(request):
>
>         if not 'products' in request.session:
>                 request.session['products']=[]
>
>         product = {}
>         for k,v in request.POST.items():
>                 product[k]=v
>
>         request.session['products'].append(product)
>
>         return render_to_response('addtobasket.html', {'products':
> request.session['products']})
>
> -------/Django-------
>
> This is not working as i expected it.
>
> Just two elements are added. When trying to add a third element - the
> second one is overwritten.
>
> i am using OS X 10.5, Python 2.5 and Django 1.0.2
>
> Thx a lot,
>
> Bjoern
--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to