title: Django. Error message for login form
body: <p>I make login/password form:</p>
  
  <p>model:</p>
  
  <pre><code>class LoginForm(forms.Form):
  username = forms.CharField(max_length=100)
  password = forms.CharField(widget=forms.PasswordInput(render_value=False),max_length=100)
  </code></pre>
  
  <p>view:</p>
  
  <pre><code>def login_view(request):
      if request.method == 'POST':
          username = request.POST['email']
          password = request.POST['password']
          user = authenticate(username=username, password=password)
          if user is not None and user.is_active:
              login(request, user)
              return HttpResponseRedirect("/n1.html")# Redirect to a success page.
          return HttpResponseRedirect("/login")
      form=LoginForm()
      return render(request, 'enter.html', {'login_form': LoginForm})
  </code></pre>
  
  <p>urls:</p>
  
  <pre><code>(r'^login/$', login_view),
  </code></pre>
  
  <p>template:</p>
  
  <pre><code>{% if form.errors %}
  &lt;p&gt;Something is wrong&lt;/p&gt;
  {% endif %}
  
  &lt;form class="form-signin" action="" method="post"&gt;
      &lt;h2 class="form-signin-heading"&gt;Login&lt;/h2&gt;
      {% csrf_token %}
  
      &lt;input class="input-block-level" type="text" name="email" value="" id="email" placeholder="Email"&gt;
  
      &lt;input class="input-block-level" type="password" name="password" value="" id="username" placeholder="Password"&gt;
  
      &lt;button class="btn btn-large btn-primary" type="submit"&gt;Login&lt;/button&gt;
      &lt;input type="hidden" name="next" value="{{next|escape}}" /&gt;
  
  &lt;/form&gt;
  </code></pre>
  
  <p>I use redirect to login page then login or password is wrong, but I want to make error message in this case. Why construction {% if form.errors %} doesn't work? Thx!</p>