class user_sessions.middleware.SessionMiddleware(get_response=None)

Middleware that provides ip and user_agent to the session store.


Session Backends

Template Tags


Transform a User Agent into human readable text.

Example output:

  • Safari on iPhone
  • Chrome on Windows 8.1
  • Safari on OS X
  • Firefox
  • Linux
  • None

Transform an IP address into an approximate location.

Example output:

  • Zwolle, The Netherlands
  • The Netherlands
  • None


class user_sessions.views.SessionListView(**kwargs)

View for listing a user’s own sessions.

This view shows list of a user’s currently active sessions. You can override the template by providing your own template at user_sessions/session_list.html.

class user_sessions.views.SessionDeleteView(**kwargs)

View for deleting a user’s own session.

This view allows a user to delete an active session. For example log out a session from a computer at the local library or a friend’s place.

Unit tests