Code

Ticket #13020: sessions.diff

File sessions.diff, 925 bytes (added by elbarto, 3 years ago)
Line 
1Index: docs/topics/http/sessions.txt
2===================================================================
3--- docs/topics/http/sessions.txt       (revisión: 14780)
4+++ docs/topics/http/sessions.txt       (copia de trabajo)
5@@ -313,6 +313,17 @@
6     datetime.datetime(2005, 8, 20, 13, 35, 0)
7     >>> s.save()
8 
9+If no ``session_key`` is provided, one will be generated automatically:
10+
11+    >>> from django.contrib.sessions.backends.db import SessionStore
12+    >>> s = SessionStore()
13+    >>> s['last_login'] = datetime.datetime(2005, 8, 20, 13, 35, 10)
14+    >>> s['last_login']
15+    datetime.datetime(2005, 8, 20, 13, 35, 0)
16+    >>> s.save()
17+    >>> s.session_key
18+    '2b1189a188b44ad18c35e113ac6ceead'
19+
20 If you're using the ``django.contrib.sessions.backends.db`` backend, each
21 session is just a normal Django model. The ``Session`` model is defined in
22 ``django/contrib/sessions/models.py``. Because it's a normal model, you can