With database sessions out of the box, no.

https://github.com/django/django/blob/master/django/contrib/sessions/base_session.py

You can see there are three attributes for a session model: key, data and 
expire_date

That said, since sessions are backed by browser cookies, django's default 
is two weeks for session cookies as you can see at 
https://docs.djangoproject.com/en/2.1/ref/settings/#std:setting-SESSION_COOKIE_AGE,
 
which are used here:  
https://github.com/django/django/blob/master/django/contrib/sessions/backends/base.py#L225-L244

So if you haven't altered that, all sessions expire in two weeks, and you 
can just delete those expired sessions by using the clearsessions 
management command 
<https://github.com/django/django/blob/master/django/contrib/sessions/management/commands/clearsessions.py>
.

if you have changed that, then what Hemendra suggested above seems like a 
reasonable approach, but one that is not backwards compatible if you don't 
have a timestamp field for last access 


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b10c3784-10ea-496e-8e62-2a212a7e8238%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to