tags:

views:

18

answers:

2
request.session['list'] = []
if request.method =='POST':    
  newrecord = request.POST['market']
  tmp = request.session['list']
  tmp.append(newrecord)
  request.session['market_list'] = tmp

I turn out that previous data was overwrite by the new one

A: 

You are assigning an empty list to request.session['list'] in the first line of the code snippet you have given. Is this by design? In that case it is no surprise that tmp always ends up with one element only.

Manoj Govindan
A: 

change request.session['list'] = [] to

if not request.session.has_key('list'):     
  request.session['list'] = []
dmitko