| 1 |
from django.contrib.sessions.base_session import AbstractBaseSession, BaseSessionManager |
| 2 |
|
| 3 |
|
| 4 |
class SessionManager(BaseSessionManager): |
| 5 |
use_in_migrations = True |
| 6 |
|
| 7 |
|
| 8 |
class Session(AbstractBaseSession): |
| 9 |
""" |
| 10 |
Django provides full support for anonymous sessions. The session |
| 11 |
framework lets you store and retrieve arbitrary data on a |
| 12 |
per-site-visitor basis. It stores data on the server side and |
| 13 |
abstracts the sending and receiving of cookies. Cookies contain a |
| 14 |
session ID -- not the data itself. |
| 15 |
|
| 16 |
The Django sessions framework is entirely cookie-based. It does |
| 17 |
not fall back to putting session IDs in URLs. This is an intentional |
| 18 |
design decision. Not only does that behavior make URLs ugly, it makes |
| 19 |
your site vulnerable to session-ID theft via the "Referer" header. |
| 20 |
|
| 21 |
For complete documentation on using Sessions in your code, consult |
| 22 |
the sessions documentation that is shipped with Django (also available |
| 23 |
on the Django web site). |
| 24 |
""" |
| 25 |
|
| 26 |
objects = SessionManager() |
| 27 |
|
| 28 |
@classmethod |
| 29 |
def get_session_store_class(cls): |
| 30 |
from django.contrib.sessions.backends.db import SessionStore |
| 31 |
|
| 32 |
return SessionStore |
| 33 |
|
| 34 |
class Meta(AbstractBaseSession.Meta): |
| 35 |
db_table = "django_session" |