Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[1.2.X] Fixed #13020 - add clarifying note to SessionStore. thanks el…

…barto for the patch.

Backport of r15053 from trunk.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@15054 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 40f2bb37c9e3c5f11716f513a4739a88bc82ca34 1 parent 3003dde
@timgraham timgraham authored
Showing with 9 additions and 0 deletions.
  1. +9 −0 docs/topics/http/sessions.txt
View
9 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

0 comments on commit 40f2bb3

Please sign in to comment.
Something went wrong with that request. Please try again.