File tree Expand file tree Collapse file tree 3 files changed +37
-5
lines changed
plain-sessions/plain/sessions Expand file tree Collapse file tree 3 files changed +37
-5
lines changed Original file line number Diff line number Diff line change @@ -188,7 +188,7 @@ def cycle_key(self):
188
188
def _load (self ):
189
189
try :
190
190
session = self ._model .objects .get (
191
- session_key = self .session_key , expire_date__gt = timezone .now ()
191
+ session_key = self .session_key , expires_at__gt = timezone .now ()
192
192
)
193
193
except (self ._model .DoesNotExist , SuspiciousOperation ) as e :
194
194
if isinstance (e , SuspiciousOperation ):
@@ -225,7 +225,7 @@ def save(self, must_create=False):
225
225
obj = self ._model (
226
226
session_key = self ._get_or_create_session_key (),
227
227
session_data = self ._encode (data ),
228
- expire_date = timezone .now () + timedelta (seconds = settings .SESSION_COOKIE_AGE ),
228
+ expires_at = timezone .now () + timedelta (seconds = settings .SESSION_COOKIE_AGE ),
229
229
)
230
230
231
231
using = router .db_for_write (self ._model , instance = obj )
Original file line number Diff line number Diff line change
1
+ # Generated by Plain 0.34.1 on 2025-03-27 21:50
2
+
3
+ from plain import models
4
+ from plain .models import migrations
5
+
6
+
7
+ class Migration (migrations .Migration ):
8
+ dependencies = [
9
+ ("plainsessions" , "0003_alter_session_expire_date_and_more" ),
10
+ ]
11
+
12
+ operations = [
13
+ migrations .AlterModelManagers (
14
+ name = "session" ,
15
+ managers = [],
16
+ ),
17
+ migrations .RemoveIndex (
18
+ model_name = "session" ,
19
+ name = "plainsessio_expire__b3ffa6_idx" ,
20
+ ),
21
+ migrations .RenameField (
22
+ model_name = "session" ,
23
+ old_name = "expire_date" ,
24
+ new_name = "expires_at" ,
25
+ ),
26
+ migrations .AddIndex (
27
+ model_name = "session" ,
28
+ index = models .Index (
29
+ fields = ["expires_at" ], name = "plainsessio_expires_d87cb5_idx"
30
+ ),
31
+ ),
32
+ ]
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ def clear_expired(self):
7
7
"""
8
8
Clear expired sessions from the database.
9
9
"""
10
- self .filter (expire_date__lt = timezone .now ()).delete ()
10
+ self .filter (expires_at__lt = timezone .now ()).delete ()
11
11
12
12
13
13
@models .register_model
@@ -31,13 +31,13 @@ class Session(models.Model):
31
31
32
32
session_key = models .CharField (max_length = 40 , primary_key = True )
33
33
session_data = models .TextField ()
34
- expire_date = models .DateTimeField ()
34
+ expires_at = models .DateTimeField ()
35
35
36
36
objects = SessionManager ()
37
37
38
38
class Meta :
39
39
indexes = [
40
- models .Index (fields = ["expire_date " ]),
40
+ models .Index (fields = ["expires_at " ]),
41
41
]
42
42
43
43
def __str__ (self ):
You can’t perform that action at this time.
0 commit comments