title: NotImplementedError: Django doesn't provide a DB representation for AnonymousUser
body: <p>I get the following error:</p>
  
  <pre><code>Traceback:
  
   File "C:\Users\HP\GST\lib\site-packages\django\core\handlers\exception.py" 
   in inner
   35.             response = get_response(request)
  
   File "C:\Users\HP\GST\lib\site-packages\django\core\handlers\base.py" in 
    _get_response
    128.                 response = self.process_exception_by_middleware(e, 
   request)
  
   File "C:\Users\HP\GST\lib\site-packages\django\core\handlers\base.py" in 
   _get_response
   126.                 response = wrapped_callback(request, *callback_args, 
   **callback_kwargs)
  
    File "C:\Users\HP\Desktop\erpcloud\accounts\views.py" in change_password
     31.         if form.is_valid():
  
   File "C:\Users\HP\GST\lib\site-packages\django\forms\forms.py" in is_valid
   179.         return self.is_bound and not self.errors
  
  File "C:\Users\HP\GST\lib\site-packages\django\forms\forms.py" in errors
   174.             self.full_clean()
  
   File "C:\Users\HP\GST\lib\site-packages\django\forms\forms.py" in 
   full_clean
    376.         self._clean_fields()
  
   File "C:\Users\HP\GST\lib\site-packages\django\forms\forms.py" in 
  _clean_fields
   397.                     value = getattr(self, 'clean_%s' % name)()
  
    File "C:\Users\HP\GST\lib\site-packages\django\contrib\auth\forms.py" in 
   clean_old_password
    366.         if not self.user.check_password(old_password):
  
   File "C:\Users\HP\GST\lib\site-packages\django\contrib\auth\models.py" in 
   check_password
    396.         raise NotImplementedError("Django doesn't provide a DB 
    representation for AnonymousUser.")
  
    Exception Type: NotImplementedError at /accounts/change-password/
     Exception Value: Django doesn't provide a DB representation for 
    AnonymousUser.
  </code></pre>
  
  <p>My view looks like this:</p>
  
  <pre><code>def change_password(request):
      if request.method == 'POST':
          form = PasswordChangeForm(data=request.POST, user=request.user)
  
          if form.is_valid():
              form.save()
              update_session_auth_hash(request, user)
              return redirect(reverse('company:Dashboard'))
          else:
              return redirect(reverse('accounts:change_password'))
      else:
          form = PasswordChangeForm(user=request.user)
  
          args = {'form': form}
          return render(request, 'accounts/change_password.html', args)
  </code></pre>
  
  <p>Firstly, I thought that this was due to the fact that I didn't have Django updated, but now I have, and I receive the same error.</p>
  
  <p>I've looked at some solutions that other users asked, but none applied in my case</p>
  
  <p>Any help, please ?</p>