Changes between Version 6 and Version 7 of NewbieMistakes


Ignore:
Timestamp:
Oct 4, 2005, 10:38:54 AM (19 years ago)
Author:
Boffbowsh
Comment:

Added pitfall on appending to lists in sessions

Legend:

Unmodified
Added
Removed
Modified
  • NewbieMistakes

    v6 v7  
    4545
    4646current_zip = meta.IntegerField(maxlength=5,null=True,blank=True)
     47
     48
     49== Appending to a list in session doesn't work ==
     50
     51==== Problem ====
     52
     53If you have a list in your session, append operations don't get saved to the object. 
     54
     55==== Solution ====
     56
     57Copy the list out of the session object, append to it, then copy it back in:
     58
     59{{{
     60sessionlist = request.session['my_list']
     61sessionlist.append(new_object)
     62request.session['my_list'] = sessionlist
Back to Top