sessions.backends.base.SessionBase.set_test_cookie()

set_test_cookie() Sets a test cookie to determine whether the user’s browser supports cookies. Due to the way cookies work, you won’t be able to test this until the user’s next page request. See Setting test cookies below for more information.

sessions.backends.base.SessionBase.set_expiry()

set_expiry(value) Sets the expiration time for the session. You can pass a number of different values: If value is an integer, the session will expire after that many seconds of inactivity. For example, calling request.session.set_expiry(300) would make the session expire in 5 minutes. If value is a datetime or timedelta object, the session will expire at that specific date/time. Note that datetime and timedelta values are only serializable if you are using the PickleSerializer. If value is

sessions.backends.base.SessionBase.test_cookie_worked()

test_cookie_worked() Returns either True or False, depending on whether the user’s browser accepted the test cookie. Due to the way cookies work, you’ll have to call set_test_cookie() on a previous, separate page request. See Setting test cookies below for more information.

sessions.backends.base.SessionBase.__delitem__()

__delitem__(key) Example: del request.session['fav_color']. This raises KeyError if the given key isn’t already in the session.

sessions.backends.base.SessionBase.keys()

keys()

sessions.backends.base.SessionBase.get_expiry_age()

get_expiry_age() Returns the number of seconds until this session expires. For sessions with no custom expiration (or those set to expire at browser close), this will equal SESSION_COOKIE_AGE. This function accepts two optional keyword arguments: modification: last modification of the session, as a datetime object. Defaults to the current time. expiry: expiry information for the session, as a datetime object, an int (in seconds), or None. Defaults to the value stored in the session by set_

sessions.backends.base.SessionBase.get_expiry_date()

get_expiry_date() Returns the date this session will expire. For sessions with no custom expiration (or those set to expire at browser close), this will equal the date SESSION_COOKIE_AGE seconds from now. This function accepts the same keyword arguments as get_expiry_age().

sessions.backends.base.SessionBase.get_expire_at_browser_close()

get_expire_at_browser_close() Returns either True or False, depending on whether the user’s session cookie will expire when the user’s Web browser is closed.

sessions.backends.base.SessionBase.get()

get(key, default=None) Example: fav_color = request.session.get('fav_color', 'red')

sessions.backends.base.SessionBase.items()

items()