Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1"""
3Abstract
4--------
6There are various things to remember when working with sessions in Django. This simple wrapper makes it easy to work
7with a Django session in an object-oriented manner.
9Install
10-------
12Other than `configuring Django sessions`_ there are no installation steps for this package.
14.. _configuring Django sessions: https://docs.djangoproject.com/en/stable/topics/http/sessions/
16Usage
17-----
19To use a session in a view:
21.. code-block:: python
23 from superdjango.sessions import Session
25 def my_view(request):
26 session = Session(request, prefix="myapp")
27 session.set("has_viewed_my_view", True)
28 # ...
30 def my_other_view(request):
31 session = Session(request, prefix="myapp")
32 if not session.has("has_viewed_my_view"):
33 redirect(reverse("my_view"))
35 # ...
37The ``prefix`` is optional, but helps prevent collisions. It's also handy when working with an app that has multiple
38session variables.
40"""
41__author__ = "Shawn Davis <shawn@superdjango.com>"
42__maintainer__ = "Shawn Davis <shawn@superdjango.com>"
43__version__ = "0.4.0-x"
45from .library import *
47__all__ = (
48 "Session",
49)