title: why i am having an attribute error in django
body: <p>I'm beginner in django and studying it recently from a course, i'm working on authentication and login and logout functionality here is my Error 
  <a href="https://i.stack.imgur.com/EkOpW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EkOpW.png" alt="enter image description here"></a></p>
  
  <p>And here is my views.py file </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_ative:
              login(request, user)
              return HttpResponseRedirect(reverse('index'))
          else:
              return HttpResponseRedirect("ACCOUNT NOT ACTIVE")
      else:
          print("Someone tried to login and failed")
          print('Username:{} and password {}'.format(username, password))
          return HttpResponse("INVALID LOGIN DETAILS SUPPLIED")
  else:
      return render(request, 'basic_app/login.html', {})
  </code></pre>
  
  <p>And here is my login.html file </p>
  
  <pre><code>{% extends 'basic_app/base.html' %}
  {% block body_block %}
  &lt;div class = 'jumbotron'&gt;
  &lt;h1&gt;Please Login&lt;/h1&gt;
  &lt;form action="{% url 'basic_app:user_login' %}" method="POST"&gt;
  {% csrf_token %}
  &lt;label for="username"&gt;Username&lt;/label&gt;
  &lt;input type="text" name="username" placeholder="Enter Username"&gt;
  
  &lt;label for="password"&gt;Password:&lt;/label&gt;
  &lt;input type="password" name="password" placeholder="Enter Password"&gt;
  
  &lt;input type="submit" value="submit"&gt;
  &lt;/form&gt;
  &lt;/div&gt;
  {% endblock %}
  </code></pre>