Development of an internal social media platform with personalised dashboards for students
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.

models.py 1.2KB

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