Ticket #13020: sessions.diff

File sessions.diff, 925 bytes (added by elbarto, 5 years ago)
  • docs/topics/http/sessions.txt

     
    313313    datetime.datetime(2005, 8, 20, 13, 35, 0)
    314314    >>> s.save()
    315315
     316If no ``session_key`` is provided, one will be generated automatically:
     317
     318    >>> from django.contrib.sessions.backends.db import SessionStore
     319    >>> s = SessionStore()
     320    >>> s['last_login'] = datetime.datetime(2005, 8, 20, 13, 35, 10)
     321    >>> s['last_login']
     322    datetime.datetime(2005, 8, 20, 13, 35, 0)
     323    >>> s.save()
     324    >>> s.session_key
     325    '2b1189a188b44ad18c35e113ac6ceead'
     326
    316327If you're using the ``django.contrib.sessions.backends.db`` backend, each
    317328session is just a normal Django model. The ``Session`` model is defined in
    318329``django/contrib/sessions/models.py``. Because it's a normal model, you can
Back to Top