Skip to content

Commit 709b120

Browse files
committed
upd readmes
1 parent a202d86 commit 709b120

File tree

2 files changed

+35
-5
lines changed

2 files changed

+35
-5
lines changed

README.md

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,32 @@ Add to `settings.py`:
4545
AUTO_LOGOUT = {'IDLE_TIME': 600} # logout after 10 minutes of downtime
4646
```
4747

48+
or the same, but with `datetime.timedelta` (more semantically):
49+
50+
```python
51+
from datetime import timedelta
52+
53+
AUTO_LOGOUT = {'IDLE_TIME': timedelta(minutes=10)}
54+
```
55+
4856
## ⌛ Limit session time
4957

5058
Logout a user after 3600 seconds (hour) from the last login.
5159

5260
Add to `settings.py`:
5361

54-
5562
```python
5663
AUTO_LOGOUT = {'SESSION_TIME': 3600}
5764
```
5865

66+
or the same, but with `datetime.timedelta` (more semantically):
67+
68+
```python
69+
from datetime import timedelta
70+
71+
AUTO_LOGOUT = {'SESSION_TIME': timedelta(hours=1)}
72+
```
73+
5974
## ✉️ Show messages when logging out automatically
6075

6176
Set the message that will be displayed after the user automatically logs out of the system:
@@ -95,9 +110,11 @@ in case of downtime (5 minutes or more) and not allow working within one session
95110
for more than half an hour:
96111

97112
```python
113+
from datetime import timedelta
114+
98115
AUTO_LOGOUT = {
99-
'IDLE_TIME': 300, # 5 minutes
100-
'SESSION_TIME': 1800, # 30 minutes
116+
'IDLE_TIME': timedelta(minutes=5),
117+
'SESSION_TIME': timedelta(minutes=30),
101118
'MESSAGE': 'The session has expired. Please login again to continue.',
102119
}
103120
```

README.rst

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ Add to `settings`:
4444
4545
AUTO_LOGOUT = {'IDLE_TIME': 600} # logout after 10 minutes of downtime
4646
47+
or the same, but with `datetime.timedelta` (more semantically):
48+
49+
.. code:: python
50+
51+
AUTO_LOGOUT = {'IDLE_TIME': timedelta(minutes=10)}
4752
4853
Limit session time
4954
------------------
@@ -56,6 +61,12 @@ Add to `settings`:
5661
5762
AUTO_LOGOUT = {'SESSION_TIME': 3600}
5863
64+
or the same, but with `datetime.timedelta` (more semantically):
65+
66+
.. code:: python
67+
68+
AUTO_LOGOUT = {'SESSION_TIME': timedelta(hours=1)}
69+
5970
Show messages when logging out automatically
6071
--------------------------------------------
6172

@@ -95,8 +106,10 @@ for more than half an hour:
95106

96107
.. code:: python
97108
109+
from datetime import timedelta
110+
98111
AUTO_LOGOUT = {
99-
'IDLE_TIME': 300, # 5 minutes
100-
'SESSION_TIME': 1800, # 30 minutes
112+
'IDLE_TIME': timedelta(minutes=5),
113+
'SESSION_TIME': timedelta(minutes=30),
101114
'MESSAGE': 'The session has expired. Please login again to continue.',
102115
}

0 commit comments

Comments
 (0)