title: NoReverseMatch errors during Django forgot password email system
body: <p>I am trying to create a system for resetting forgotten passwords through email but am getting some errors.</p>
  
  <p>My urls are:</p>
  
  <pre><code>from django.contrib.auth import views as auth_views
  
  urlpatterns = [
      url(r'^$', auth_views.login, name='login'),
      url(r'^logout/$', auth_views.logout, name='logout'),
      ## more irrelevant urls here ##
      url(r'^password/reset/done/$', auth_views.PasswordResetDoneView.as_view(), name='password_reset_done'),
      url(r'^password/reset/$', auth_views.PasswordResetView.as_view(), name='password_reset'),
      url(r'^password/reset/(?P&lt;uidb64&gt;[0-9A-Za-z_\-]+)/(?P&lt;token&gt;[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$', auth_views.PasswordResetConfirmView.as_view(), name='password_reset_confirm'),
      url(r'^password/reset/complete/$', auth_views.PasswordResetCompleteView.as_view(), name='password_reset_complete'),
  ]
  </code></pre>
  
  <p>When the email address is submitted at <code>password_reset</code>, the email sends but I get this error:</p>
  
  <pre><code>Internal Server Error: /password/reset/
  Traceback (most recent call last):
    File "C:\python\lib\site-packages\django\core\handlers\exception.py", line 41, in inner
      response = get_response(request)
    File "C:\python\lib\site-packages\django\core\handlers\base.py", line 187, in _get_response
      response = self.process_exception_by_middleware(e, request)
    File "C:\python\lib\site-packages\django\core\handlers\base.py", line 185, in _get_response
      response = wrapped_callback(request, *callback_args, **callback_kwargs)
    File "C:\python\lib\site-packages\django\views\generic\base.py", line 68, in view
      return self.dispatch(request, *args, **kwargs)
    File "C:\python\lib\site-packages\django\utils\decorators.py", line 67, in _wrapper
      return bound_func(*args, **kwargs)
    File "C:\python\lib\site-packages\django\utils\decorators.py", line 149, in _wrapped_view
      response = view_func(request, *args, **kwargs)
    File "C:\python\lib\site-packages\django\utils\decorators.py", line 63, in bound_func
      return func.__get__(self, type(self))(*args2, **kwargs2)
    File "C:\python\lib\site-packages\django\contrib\auth\views.py", line 439, in dispatch
      return super(PasswordResetView, self).dispatch(*args, **kwargs)
    File "C:\python\lib\site-packages\django\views\generic\base.py", line 88, in dispatch
      return handler(request, *args, **kwargs)
    File "C:\python\lib\site-packages\django\views\generic\edit.py", line 183, in post
      return self.form_valid(form)
    File "C:\python\lib\site-packages\django\contrib\auth\views.py", line 453, in form_valid
      return super(PasswordResetView, self).form_valid(form)
    File "C:\python\lib\site-packages\django\views\generic\edit.py", line 79, in form_valid
      return HttpResponseRedirect(self.get_success_url())
    File "C:\python\lib\site-packages\django\views\generic\edit.py", line 67, in get_success_url
      if self.success_url:
    File "C:\python\lib\site-packages\django\utils\functional.py", line 114, in __wrapper__
      res = func(*self.__args, **self.__kw)
    File "C:\python\lib\site-packages\django\urls\base.py", line 91, in reverse
      return force_text(iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs)))
    File "C:\python\lib\site-packages\django\urls\resolvers.py", line 497, in _reverse_with_prefix
      raise NoReverseMatch(msg)
  django.urls.exceptions.NoReverseMatch: Reverse for 'password_reset_done' not found. 'password_reset_done' is not a valid view function or pattern name.
  [11/Feb/2018 14:32:04] "POST /password/reset/ HTTP/1.1" 500 121086
  </code></pre>
  
  <p>When I copy the link into the browser and reset the password, the password resets correctly but the following error appears:</p>
  
  <pre><code>Internal Server Error: /password/reset/MQ/set-password/
  Traceback (most recent call last):
    File "C:\python\lib\site-packages\django\core\handlers\exception.py", line 41, in inner
      response = get_response(request)
    File "C:\python\lib\site-packages\django\core\handlers\base.py", line 187, in _get_response
      response = self.process_exception_by_middleware(e, request)
    File "C:\python\lib\site-packages\django\core\handlers\base.py", line 185, in _get_response
      response = wrapped_callback(request, *callback_args, **callback_kwargs)
    File "C:\python\lib\site-packages\django\views\generic\base.py", line 68, in view
      return self.dispatch(request, *args, **kwargs)
    File "C:\python\lib\site-packages\django\utils\decorators.py", line 67, in _wrapper
      return bound_func(*args, **kwargs)
    File "C:\python\lib\site-packages\django\views\decorators\debug.py", line 76, in sensitive_post_parameters_wrapper
      return view(request, *args, **kwargs)
    File "C:\python\lib\site-packages\django\utils\decorators.py", line 63, in bound_func
      return func.__get__(self, type(self))(*args2, **kwargs2)
    File "C:\python\lib\site-packages\django\utils\decorators.py", line 67, in _wrapper
      return bound_func(*args, **kwargs)
    File "C:\python\lib\site-packages\django\views\decorators\cache.py", line 57, in _wrapped_view_func
      response = view_func(request, *args, **kwargs)
    File "C:\python\lib\site-packages\django\utils\decorators.py", line 63, in bound_func
      return func.__get__(self, type(self))(*args2, **kwargs2)
    File "C:\python\lib\site-packages\django\contrib\auth\views.py", line 489, in dispatch
      return super(PasswordResetConfirmView, self).dispatch(*args, **kwargs)
    File "C:\python\lib\site-packages\django\views\generic\base.py", line 88, in dispatch
      return handler(request, *args, **kwargs)
    File "C:\python\lib\site-packages\django\views\generic\edit.py", line 183, in post
      return self.form_valid(form)
    File "C:\python\lib\site-packages\django\contrib\auth\views.py", line 522, in form_valid
      return super(PasswordResetConfirmView, self).form_valid(form)
    File "C:\python\lib\site-packages\django\views\generic\edit.py", line 79, in form_valid
      return HttpResponseRedirect(self.get_success_url())
    File "C:\python\lib\site-packages\django\views\generic\edit.py", line 67, in get_success_url
      if self.success_url:
    File "C:\python\lib\site-packages\django\utils\functional.py", line 114, in __wrapper__
      res = func(*self.__args, **self.__kw)
    File "C:\python\lib\site-packages\django\urls\base.py", line 91, in reverse
      return force_text(iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs)))
    File "C:\python\lib\site-packages\django\urls\resolvers.py", line 497, in _reverse_with_prefix
      raise NoReverseMatch(msg)
  django.urls.exceptions.NoReverseMatch: Reverse for 'password_reset_complete' not found. 'password_reset_complete' is not a valid view function or pattern name.
  [11/Feb/2018 14:37:16] "POST /password/reset/MQ/set-password/ HTTP/1.1" 500 134868
  </code></pre>
  
  <p>Technically the system functions, but obviously these error messages are not ideal.</p>
  
  <p>These are the other questions I have asked about this:</p>
  
  <p><a href="https://stackoverflow.com/questions/48720943/noreversematch-error-with-password-reset-emails">NoReverseMatch error with password reset emails</a></p>
  
  <p><a href="https://stackoverflow.com/questions/48729812/error-with-system-for-email-password-resets">Error with system for email password resets</a></p>
  
  <p>And this is the <a href="https://simpleisbetterthancomplex.com/tutorial/2016/09/19/how-to-create-password-reset-view.html" rel="nofollow noreferrer">tutorial</a> I followed.</p>