Ticket #5544: 5544.diff
File 5544.diff, 999 bytes (added by , 17 years ago) |
---|
-
docs/sessions.txt
198 198 199 199 An API is available to manipulate session data outside of a view:: 200 200 201 >>> from django.contrib.sessions. engines.db import SessionStore201 >>> from django.contrib.sessions.backends.db import SessionStore 202 202 >>> s = SessionStore(session_key='2b1189a188b44ad18c35e113ac6ceead') 203 203 >>> s['last_login'] = datetime.datetime(2005, 8, 20, 13, 35, 10) 204 204 >>> s['last_login'] 205 205 datetime.datetime(2005, 8, 20, 13, 35, 0) 206 206 >>> s.save() 207 207 208 If you're using the ``django.contrib.sessions. engine.db`` backend, each208 If you're using the ``django.contrib.sessions.backends.db`` backend, each 209 209 session is just a normal Django model. The ``Session`` model is defined in 210 210 ``django/contrib/sessions/models.py``. Because it's a normal model, you can 211 211 access sessions using the normal Django database API::