code: def process_request(self, request):
          
          
          if django.VERSION < (1, 10):
              is_authenticated = request.user.is_authenticated()
          else:
              is_authenticated = request.user.is_authenticated
  
          if not is_authenticated:
              return
  
          now = datetime.now()
          if '_session_security' not in request.session:
              set_last_activity(request.session, now)
              return
  
          delta = now - get_last_activity(request.session)
          expire_seconds = self.get_expire_seconds(request)
          if delta >= timedelta(seconds=expire_seconds):
              logout(request)
          elif (request.path == reverse('session_security_ping') and
                  'idleFor' in request.GET):
              self.update_last_activity(request, now)
          elif not self.is_passive_request(request):
              set_last_activity(request.session, now)
docs: Update last activity time or logout.