[Django]-Django Password Reset

3👍

  1. Copy C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django-2.1.1-py3.7.egg\django\contrib\admin\templates\registration\password_reset_email.html to partners\templates\registration\
  2. Edit line 6 of the file partners\templates\registration\password_reset_email.html to

    {{ protocol }}://{{ domain }}{% url 'partners:password_reset_confirm' uidb64=uid token=token %}
    
  3. Update your urls.py to point to right template:

    url(
        r'^password_reset/$',
        auth_views.PasswordResetView.as_view(
            template_name="registration/password_reset.html",
            email_template_name="registration/password_reset_email.html",
            success_url=reverse_lazy('partners:password_reset_done'), # might be required
        ),
        name='password_reset'
    ),
    

0👍

As you mentioned the urls.py is of partners, so reverse call should be to partners, change in your template
{% url 'password_reset_confirm' uidb64=uid token=token %}
to {% url 'partners:password_reset_confirm' uidb64=uid token=token %}.

partners is app name.
This will work.

Leave a comment