Reputation: 4706
I am currently reading about session expiration and I am curious as to how django would know if a session expired ? Currently I have read about reading and writing to sessions in Django and how to set expiration of a session but have not encountered anything on validating a session. How do I know if a session is still Valid using Django ?
Upvotes: 0
Views: 424
Reputation: 2763
You can set Expire time for session using set_expire function:
request.session.set_expiry(300)
You can validate session using is_authenticated function:
request.user.is_authenticated()
Upvotes: 1