So I’m trying to use the default reset password form from django and this is my urls now:
urls:
path('reset_password/',
auth_views.PasswordResetView.as_view(success_url=reverse_lazy('home:password_reset_done'), template_name="accounts/password_reset.html"),
name="reset_password"),
path('reset_password_sent/',
auth_views.PasswordResetDoneView.as_view(template_name="accounts/password_reset_sent.html"),
name="password_reset_done"),
path('reset/confirm/<uidb64>/<token>/',
auth_views.PasswordResetConfirmView.as_view(success_url=reverse_lazy('home:password_reset_complete'), template_name="accounts/password_reset_form.html"),
name="password_reset_confirm"),
path('reset_password_complete/',
auth_views.PasswordResetCompleteView.as_view(template_name="accounts/password_reset_done.html"),
name="password_reset_complete"),
]
I did the success url thing because my stuff is in the home folder so django can find where the stuff is and the first view is rendered but after I click the reset button this error appears:
Internal Server Error: /reset_password/
Traceback (most recent call last):
File "C:\Users\Finn\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\handlers\exception.py", line 47, in inner
response = get_response(request)
File "C:\Users\Finn\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\handlers\base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Users\Finn\AppData\Local\Programs\Python\Python39\lib\site-packages\django\views\generic\base.py", line 70, in view
return self.dispatch(request, *args, **kwargs)
File "C:\Users\Finn\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\decorators.py", line 43, in _wrapper
return bound_method(*args, **kwargs)
File "C:\Users\Finn\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\decorators.py", line 130, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "C:\Users\Finn\AppData\Local\Programs\Python\Python39\lib\site-packages\django\contrib\auth\views.py", line 222, in dispatch
return super().dispatch(*args, **kwargs)
File "C:\Users\Finn\AppData\Local\Programs\Python\Python39\lib\site-packages\django\views\generic\base.py", line 98, in dispatch
return handler(request, *args, **kwargs)
File "C:\Users\Finn\AppData\Local\Programs\Python\Python39\lib\site-packages\django\views\generic\edit.py", line 142, in post
return self.form_valid(form)
File "C:\Users\Finn\AppData\Local\Programs\Python\Python39\lib\site-packages\django\contrib\auth\views.py", line 235, in form_valid
form.save(**opts)
File "C:\Users\Finn\AppData\Local\Programs\Python\Python39\lib\site-packages\django\contrib\auth\forms.py", line 310, in save
self.send_mail(
File "C:\Users\Finn\AppData\Local\Programs\Python\Python39\lib\site-packages\django\contrib\auth\forms.py", line 253, in send_mail
body = loader.render_to_string(email_template_name, context)
File "C:\Users\Finn\AppData\Local\Programs\Python\Python39\lib\site-packages\django\template\loader.py", line 62, in render_to_string
return template.render(context, request)
File "C:\Users\Finn\AppData\Local\Programs\Python\Python39\lib\site-packages\django\template\backends\django.py", line 61, in render
return self.template.render(context)
File "C:\Users\Finn\AppData\Local\Programs\Python\Python39\lib\site-packages\django\template\base.py", line 170, in render
return self._render(context)
File "C:\Users\Finn\AppData\Local\Programs\Python\Python39\lib\site-packages\django\template\base.py", line 162, in _render
return self.nodelist.render(context)
File "C:\Users\Finn\AppData\Local\Programs\Python\Python39\lib\site-packages\django\template\base.py", line 938, in render
bit = node.render_annotated(context)
File "C:\Users\Finn\AppData\Local\Programs\Python\Python39\lib\site-packages\django\template\base.py", line 905, in render_annotated
return self.render(context)
File "C:\Users\Finn\AppData\Local\Programs\Python\Python39\lib\site-packages\django\template\defaulttags.py", line 39, in render
output = self.nodelist.render(context)
File "C:\Users\Finn\AppData\Local\Programs\Python\Python39\lib\site-packages\django\template\base.py", line 938, in render
bit = node.render_annotated(context)
File "C:\Users\Finn\AppData\Local\Programs\Python\Python39\lib\site-packages\django\template\base.py", line 905, in render_annotated
return self.render(context)
File "C:\Users\Finn\AppData\Local\Programs\Python\Python39\lib\site-packages\django\template\loader_tags.py", line 53, in render
result = self.nodelist.render(context)
File "C:\Users\Finn\AppData\Local\Programs\Python\Python39\lib\site-packages\django\template\base.py", line 938, in render
bit = node.render_annotated(context)
File "C:\Users\Finn\AppData\Local\Programs\Python\Python39\lib\site-packages\django\template\base.py", line 905, in render_annotated
return self.render(context)
File "C:\Users\Finn\AppData\Local\Programs\Python\Python39\lib\site-packages\django\template\defaulttags.py", line 446, in render
url = reverse(view_name, args=args, kwargs=kwargs, current_app=current_app)
File "C:\Users\Finn\AppData\Local\Programs\Python\Python39\lib\site-packages\django\urls\base.py", line 86, in reverse
return resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
File "C:\Users\Finn\AppData\Local\Programs\Python\Python39\lib\site-packages\django\urls\resolvers.py", line 694, in _reverse_with_prefix
raise NoReverseMatch(msg)
django.urls.exceptions.NoReverseMatch: Reverse for 'password_reset_confirm' not found. 'password_reset_confirm' is not a valid view function or pattern name.
I cant find the error, at my opnion the view is correct.
Please help