-
-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
67 additions
and
1 deletion.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,8 @@ Contents: | |
:maxdepth: 2 | ||
|
||
installation | ||
|
||
usage | ||
reference | ||
|
||
|
||
Indices and tables | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Reference | ||
========= | ||
|
||
.. autoclass:: user_sessions.views.SessionListView | ||
.. autoclass:: user_sessions.views.SessionDeleteView | ||
|
||
Unit tests | ||
---------- | ||
|
||
.. autoclass:: user_sessions.utils. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
Usage | ||
===== | ||
|
||
Current session | ||
--------------- | ||
The current session is available on the request, just like the normal session | ||
middleware makes the session available:: | ||
|
||
def my_view(request): | ||
request.session | ||
|
||
|
||
All sessions | ||
------------ | ||
To get the list of a user's sessions:: | ||
|
||
sessions = user.session_set.filter(expire_date__gt=now()) | ||
|
||
You could logout the user everywhere:: | ||
|
||
user.session_set.all().delete() | ||
|
||
Generic views | ||
------------- | ||
There are two views included with this application, | ||
:class:`~user_sessions.views.SessionListView` and | ||
:class:`~user_sessions.views.SessionDeleteView`. Using this views you have a | ||
simple, but effective, user session management that even looks great without | ||
any additional styling: | ||
|
||
.. image:: _static/custom-view.png | ||
|
||
Admin views | ||
----------- | ||
|
||
The user's IP address and user agent are also stored on the session. This | ||
allows to show a list of active sessions to the user in the admin: | ||
|
||
.. image:: _static/admin-view.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters