Ticket #4914: session_modified_attr.diff

File session_modified_attr.diff, 1.1 KB (added by Thomas Güttler <hv@…>, 8 years ago)
  • docs/sessions.txt

     
    188188
    189189    # Gotcha: Session is NOT modified, because this alters
    190190    # request.session['foo'] instead of request.session.
     191    # You need to tell the session framework, that the session
     192    # has changed:
    191193    request.session['foo']['bar'] = 'baz'
     194    request.session.modified = True
    192195
    193 To change this default behavior, set the ``SESSION_SAVE_EVERY_REQUEST`` setting
    194 to ``True``. If ``SESSION_SAVE_EVERY_REQUEST`` is ``True``, Django will save
    195 the session to the database on every single request.
     196If you are lazy and don't want to set the ``modified`` attribute, you
     197can set the ``SESSION_SAVE_EVERY_REQUEST`` setting to ``True``. If
     198``SESSION_SAVE_EVERY_REQUEST`` is ``True``, Django will save the
     199session to the database on every single request.
    196200
    197201Note that the session cookie is only sent when a session has been created or
    198202modified. If ``SESSION_SAVE_EVERY_REQUEST`` is ``True``, the session cookie
Back to Top