title: Django, How to detect login success event?
body: <p>I have built a crm system using django, and I want to record the login information(the login user, the login time, the login ip address) of the successfully-logged-in user, how to detect the successfully logging event? So I can save the login_record table.My view code is like this:</p>
  
  <pre><code>  def custom_login(request, **kwargs):                                             
  
        if request.user.is_authenticated():                                          
            return redirect(settings.LOGIN_REDIRECT_URL, **kwargs)                   
        else:                                                                        
            return login(request, **kwargs)                                          
  </code></pre>