Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[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
Tim Graham authored December 25, 2010

Showing 1 changed file with 9 additions and 0 deletions. Show diff stats Hide diff stats

  1. 9  docs/topics/http/sessions.txt
9  docs/topics/http/sessions.txt
@@ -307,12 +307,21 @@ Using sessions out of views
307 307
 An API is available to manipulate session data outside of a view::
308 308
 
309 309
     >>> from django.contrib.sessions.backends.db import SessionStore
  310
+    >>> import datetime
310 311
     >>> s = SessionStore(session_key='2b1189a188b44ad18c35e113ac6ceead')
311 312
     >>> s['last_login'] = datetime.datetime(2005, 8, 20, 13, 35, 10)
312 313
     >>> s['last_login']
313 314
     datetime.datetime(2005, 8, 20, 13, 35, 0)
314 315
     >>> s.save()
315 316
 
  317
+If ``session_key`` isn't provided, one will be generated automatically::
  318
+
  319
+    >>> from django.contrib.sessions.backends.db import SessionStore
  320
+    >>> s = SessionStore()
  321
+    >>> s.save()
  322
+    >>> s.session_key
  323
+    '2b1189a188b44ad18c35e113ac6ceead'
  324
+
316 325
 If you're using the ``django.contrib.sessions.backends.db`` backend, each
317 326
 session is just a normal Django model. The ``Session`` model is defined in
318 327
 ``django/contrib/sessions/models.py``. Because it's a normal model, you can

0 notes on commit 40f2bb3

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