summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorTimo Graham <timograham@gmail.com>2010-12-25 20:46:15 +0000
committerTimo Graham <timograham@gmail.com>2010-12-25 20:46:15 +0000
commit00c554f89e184b2d4de828c82965e333a3c2a863 (patch)
treea2686780cd929e1dbc41fda0aabd8570a4d1aa07 /docs
parent8a9be7477653c0acb19e27b4e978fd32e4091e9f (diff)
Fixed #13020 - add clarifying note to SessionStore. thanks elbarto for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15053 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
-rw-r--r--docs/topics/http/sessions.txt9
1 files changed, 9 insertions, 0 deletions
diff --git a/docs/topics/http/sessions.txt b/docs/topics/http/sessions.txt
index dd48c72a23..a569c44825 100644
--- a/docs/topics/http/sessions.txt
+++ b/docs/topics/http/sessions.txt
@@ -307,12 +307,21 @@ Using sessions out of views
An API is available to manipulate session data outside of a view::
>>> from django.contrib.sessions.backends.db import SessionStore
+ >>> import datetime
>>> s = SessionStore(session_key='2b1189a188b44ad18c35e113ac6ceead')
>>> s['last_login'] = datetime.datetime(2005, 8, 20, 13, 35, 10)
>>> s['last_login']
datetime.datetime(2005, 8, 20, 13, 35, 0)
>>> s.save()
+If ``session_key`` isn't provided, one will be generated automatically::
+
+ >>> from django.contrib.sessions.backends.db import SessionStore
+ >>> s = SessionStore()
+ >>> s.save()
+ >>> s.session_key
+ '2b1189a188b44ad18c35e113ac6ceead'
+
If you're using the ``django.contrib.sessions.backends.db`` backend, each
session is just a normal Django model. The ``Session`` model is defined in
``django/contrib/sessions/models.py``. Because it's a normal model, you can