title: Django - user is_active
body: <p>This is my user authentication method:</p>
  
  <pre><code>def user_login(request):
      if request.method == 'POST':
          username = request.POST.get('username')
          password = request.POST.get('password')
          user = authenticate(username=username, password=password)
  
          if user:
              if user.is_active:
                  login(request, user)
                  return HttpResponseRedirect(reverse('index'))
              else:
                  print('TEST')
                  messages.info(request, 'Inactive user')
                  return HttpResponseRedirect(reverse('index'))
          else:
              messages.error(request, 'Invalid username/password!')
          return HttpResponseRedirect(reverse('index'))
      else:
          return render(request, 'mainapp/login.html', {})
  </code></pre>
  
  <p>If user exists and is not active wrong message appears: </p>
  
  <pre><code>messages.error(request, 'Invalid username/password!')
  return HttpResponseRedirect(reverse('index'))
  </code></pre>
  
  <p>instead of:</p>
  
  <pre><code>print('TEST')
  messages.info(request, 'Inactive user')
  return HttpResponseRedirect(reverse('index'))
  </code></pre>
  
  <p>I don't have any idea what is wrong here... Any clues?</p>