You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

38 lines
1.3 KiB

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