0
votes

I want to implement the Django reset password function but it gets stuck when it tries to sent the email. Error code: Reverse for 'password_reset_confirm' not found. 'password_reset_confirm' is not a valid view function or pattern name. error-code-picture

I´ve tried the form with crispy and I´ve tried to let Django do it all alone (without my views) but it´s not working.

urls: urls-picture

path('password-reset/',
     auth_views.PasswordResetView.as_view(
         template_name='web/users/password_reset.html'),
     name='password_reset'),
path('password-reset/done/',
     auth_views.PasswordResetDoneView.as_view(
         template_name='web/users/password_reset_done.html'),
     name='password_reset_done'),
path('password-reset-confirm/<uidb64>/<token>/',
     auth_views.PasswordResetConfirmView.as_view(
         template_name='web/users/password_reset_confirm.html'),
     name='password_reset_confirm'),

password-reset-confirm view (just the form): password-reset-confirm template

<form method="POST">
  {% csrf_token %}
  <div class="form-group">
    {{ form.email }}
    <label for="username" class="control-label">Email</label><i class="bar"></i>
  </div>
  <div class="button-container">
    <input type="submit" class="button" value="Passwort ändern"/>
  </div>
</form>

I think the problem is that it´s not passing the uidb64 and the token to the email template.

1
urls that you have posted is of main project or any app's url ?Pankaj Sharma
that are the urls from the appWebbuddy
Are your urls namespaced maybe (so in your template, you should use {% url 'account:password_reset_confirm' ... %})? the error isn't the missing uid or token, it's about a patter name not found.dirkgroten
I put a picture from my template in the question. I don´t have an url in it. If I try to use the one from Django and not my own, it´s also not working.Webbuddy
If I write the url like this: path('password-reset-confirm/<uidb64>/<token>/', auth_views.PasswordResetConfirmView.as_view(), name='password_reset_confirm'),. The same error appiers. So it had nothing to do with my template I think.Webbuddy

1 Answers

2
votes

I already found the problem. I had to write this into the main urls:

url(r'^web/', include('django.contrib.auth.urls'))

Now it works. Thank you