Today we'll learn how to check if a session is exists in django.

syntax

1
if session_key in request.session:

example:

So we have already a session, this session has 'test' as a key and we want to check if this session exists.

code:

1
2
if 'test' in request.session:
   print('yes!')

output

1
yes!

English today is not an art to be mastered it's just a tool to use to get a result