title: Django Password reset: new password must be different from any of the last four passwords user has submitted
body: <p>I am new to Django, please help me how to implement Password Reset so that new password must be different from any of the last four passwords user has submitted in django :</p>
  
  <p>I am using default django password reset:
  urls.py:</p>
  
  <pre><code>url(r'^password/reset/$',auth_views.password_reset,      
            name='auth_password_reset'),
  </code></pre>
  
  <p>django/contrib/auth/views.py:</p>
  
  <pre><code>@csrf_protect
  def password_reset(request, is_admin_site=False,
                     template_name='registration/password_reset_form.html',
                     email_template_name='registration/password_reset_email.html',
                     subject_template_name='registration/password_reset_subject.txt',
                     password_reset_form=PasswordResetForm,
                     token_generator=default_token_generator,
                     post_reset_redirect=None,
                     from_email=None,
                     current_app=None,
                     extra_context=None):
      if post_reset_redirect is None:
          post_reset_redirect = reverse('django.contrib.auth.views.password_reset_done')
      if request.method == "POST":
          form = password_reset_form(request.POST)
          if form.is_valid():
              opts = {
                  'use_https': request.is_secure(),
                  'token_generator': token_generator,
                  'from_email': from_email,
                  'email_template_name': email_template_name,
                  'subject_template_name': subject_template_name,
                  'request': request,
              }
              if is_admin_site:
                  opts = dict(opts, domain_override=request.get_host())
              form.save(**opts)
              return HttpResponseRedirect(post_reset_redirect)
      else:
          form = password_reset_form()
      context = {
          'form': form,
      }
      if extra_context is not None:
          context.update(extra_context)
      return TemplateResponse(request, template_name, context,
                              current_app=current_app)
  </code></pre>
  
  <p>Should I create database table to store all the previous passwords of the user or is there any django library which will provide me this feature.</p>