Resetting Password in Django - django

I have problem in resetting password in Django . After looking at this:Resetting Password, this error still exist....
My error is:
Reverse for 'django.contrib.auth.views.password_reset_confirm' with arguments '()' and keyword arguments '{'uidb36': '1', 'token': '392-804fab6dcec790f0ec6b'}' not found.
Here is my urls.py:
urlpatterns = patterns('lex.views',
url(r'^home/forgotpassword', 'lexrequestpassword', name='lexrequestpassword'),
url(r'^home/resetpassword', 'lexresetpassworddone', name='lexresetpassworddone'),
url(r'^home/reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$', 'lexresetpasswordconfirmed', name='lexresetpasswordconfirmed'),
url(r'^home/resetpasswordcompleted', 'lexresetpasswordcompleted', name='lexresetpasswordcompleted'),)
My views.py:
#login_required
def lexrequestpassword(request):
"""
Reset Password
"""
path = reverse('lexresetpassworddone')
return password_reset(request,post_reset_redirect=path)
#login_required
def lexresetpassworddone(request):
"""
Reset Password Done
"""
path = reverse('lexresetpasswordconfirmed')
return password_reset_done(request,template_name=path)
#login_required
def lexresetpasswordconfirmed(request):
"""
Reset Password Confirmed
"""
path = reverse('lexresetpasswordcompleted')
return password_reset_confirm(request,post_reset_redirect=path)
#login_required
def lexresetpasswordcompleted(request):
"""
Reset Password Completed
"""
path = reverse('lexmain')
return password_reset_complete(request,post_reset_redirect=path)
Not sure how to solve this. Need some guidance...

Password Reset
Django has a built-in password reset functions which we are going to use. In this tutorial we will name our app as accounts.
urls.py
from django.conf.urls import patterns, include, url
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
admin.autodiscover()
urlpatterns = patterns('',
url(
r'^admin/',
include(admin.site.urls)
),
#this is the url for password reset authentication
#Don't remove, this is important!
url(
r'^account/',
include('django.contrib.auth.urls')
),
#this is the accounts app main url
url(
r'^accounts/',
include('accounts.urls', namespace="accounts")
),
)+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += staticfiles_urlpatterns()
urls.py
from django.conf.urls import *
urlpatterns = patterns('accounts.views',
url(
r'^forgot-password/$',
'forgot_password',
name="forgot-password"
),
)
views.py
from django.contrib.auth.views import password_reset
from django.shortcuts import render
def forgot_password(request):
if request.method == 'POST':
return password_reset(request,
from_email=request.POST.get('email'))
else:
return render(request, 'forgot_password.html')
Put your base.html in your main templates folder
base.html
<html>
<head>
<title>{% block title %}{% endblock title %}</title>
</head>
<body>
{% block content %}{% endblock content %}
</body>
</html>
put this template in the app templates folder.
forgot_password.html
{% extends "base.html" %}
{% block title %}Forgot Password{% endblock title %}
{% block content %}
<form method="post" action="{% url django.contrib.auth.views.password_reset %}">
{% csrf_token %}
<p>Please enter your email address.
You will receive a link to create a new password via email.</p>
<input type="email" name="email"
placeholder="Your e-mail"><br/>
<button type="submit">Send new password</button>
</form>
{% endblock content %}
settings.py
#add email settings
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = 'user'
EMAIL_HOST_PASSWORD = 'password'
DEFAULT_FROM_EMAIL = 'your email'
Now we will override the password reset templates of the admin. In your main templates folder create registration folder. Inside the registration folder, create these files:
If you want to change the contents of the files. Make sure it is correct or else you will got an errors.
password_reset_complete.html
{% extends "base.html" %}
{% block title %}Password reset complete{% endblock title %}
{% block content %}
<h4>Reset Complete</h4>
<p>Your password has been set.
You may go ahead and log in now.</p>
Log in
{% endblock content %}
password_reset_confirm.html
{% extends "base.html" %}
{% block title %}Setting New password{% endblock title %}
{% block content %}
<h4>Set New Password</h4>
<form action="" method="post">
{% csrf_token %}
{% if validlink %}
<p>Please enter your new password twice.
So we can verify you typed it in correctly.</p>
<p>
{{ form.new_password1.errors }}<br/>
{{ form.new_password1 }}
</p>
<p class="button-height">
{{ form.new_password2.errors }}<br/>
{{ form.new_password2 }}
</p>
{% else %}
<h4>Password reset unsuccessful</h4>
<p>The password reset link was invalid,
possibly because it has already been used.
Please request a new password reset.</p><br/>
{% endif %}
<button type="submit">Change my password</button>
</form>
{% endblock content %}
password_reset_done.html
{% extends "base.html" %}
{% block title %}Password reset successful{% endblock title %}
{% block content %}
<h4>Reset Password</h4>
<p>We've e-mailed you instructions for setting
your password to the e-mail address you submitted.</p>
<p>You should be receiving it shortly.</p>
<p>Login</p>
{% endblock content %}
#password_reset_ email.html
{% load i18n %}
{% load url from future %}
{% autoescape off %}
{% blocktrans %}
You're receiving this e-mail because you requested
a password reset for your user account at {{ site_name }}.
{% endblocktrans %}
{% trans "Please go to the following page and choose a new password:" %}
{% block reset_link %}
{{ protocol }}://{{ domain }}{% url 'django.contrib.auth.views.password_reset_confirm' uidb36=uid token=token %}
{% endblock %}
{% trans "Your username, in case you've forgotten:" %} {{ user.username }}
{% trans "Thanks for using our site!" %}
{% blocktrans %}The {{ site_name }} team{% endblocktrans %}
{% endautoescape %}
password_reset_form.html
{% extends "base.html" %}
{% block title %}Password reset form{% endblock title %}
{% block content %}
<h4>Reset Password</h4>
<p>Forgotten your password?
Enter your e-mail address below,
and we'll e-mail instructions for setting a new one.</p>
<form action="" method="post">
{% csrf_token %}
{% if form.email.errors %}`enter code here`
<div class="message red-gradient">{{ form.email.errors }}</div><br/>
{% endif %}
<p>E-mail address: {{ form.email }} <br/><br/>
<input type="submit" value="Reset my password"></p>
</form>
{% endblock content %}

Than your def lexresetpasswordconfirmed(request): should accept also uidb36 and token args.

Reverse for 'django.contrib.auth.views.password_reset_confirm' with arguments '()' and keyword arguments '{'uidb36': '1', 'token': '392-804fab6dcec790f0ec6b'}' not found.
This means that at some point in the execution, you are not calling reverse on lexresetpasswordconfirmed, you are calling it on django.contrib.auth.views.password_reset_confirm.
Where is this error occurring? In the template? If so, make sure that the template you are using has
{% url lexresetpasswordconfirmed uid token %}
and not
{% url django.contrib.auth.views.password_reset_confirm uid token %}
Is the error occurring in a view? If so, somewhere you are calling reverse on django.contrib.auth.views.password_reset_confirm.
Once that error is resolved, then yes you will have to resolve the other error that Alexander pointed out, namely including the uuid and token in the view function:
#login_required
def lexresetpasswordconfirmed(request, uuid36, token):
"""
Reset Password Confirmed
"""
# you need to do SOMETHING with the uuid and token here, RIGHT?!?!
path = reverse('lexresetpasswordcompleted')
return password_reset_confirm(request,post_reset_redirect=path)
So I'm guessing on each of these returns you're using the views from django.contrib.auth, correct? Problem is that one of these views -- probably password_reset_done -- doesn't care that you've provided it with a redirect, it's using its own.

My settings.py:
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_HOST_USER = os.environ.get('EMAIL_USER')
EMAIL_HOST_PASSWORD = os.environ.get('EMAIL_PASS')
My urls.py:
urlpatterns = [
path('admin/', admin.site.urls),
path('register/', user_views.register,name='register'),
path('profile/', user_views.profile,name='profile'),
path('login/', auth_views.LoginView.as_view(template_name='users/login.html'),name='login'),
path('logout/',auth_views.LogoutView.as_view(template_name='users/logout.html'),name='logout'),
path('password-reset/',auth_views.PasswordResetView.as_view(template_name='users/password_reset.html'),name='password_reset'),
path('password-reset/done/',auth_views.PasswordResetDoneView.as_view(template_name='users/password_reset_done.html'),name='password_reset_done'),
path('password-reset-confirm/<uidb64>/<token>/',auth_views.PasswordResetConfirmView.as_view(template_name='users/password_reset_confirm.html'),name='password_reset_confirm'),
path('password-reset-complete/',
auth_views.PasswordResetCompleteView.as_view(
template_name='users/password_reset_complete.html'
),
name='password_reset_complete'),
path('', include('blog.urls')),
]
password_reset.html:
{% extends "blog/base.html" %}
{% load crispy_forms_tags %}
{% block content %}
<div class="content-section">
<form method="POST">
{% csrf_token %}
<fieldset class="form-group">
<legend class="border-bottom mb-4">Reset Password</legend>
{{ form|crispy }}
</fieldset>
<div class="form-group">
<button class="btn btn-outline-info" type="submit">Request Password Reset</button>
</div>
</form>
</div>
{% endblock content %}
password_reset_done:
{% extends "blog/base.html" %}
{% block content %}
<div class="alert alert-info">
An email has been sent with instructions to reset your password
</div>
{% endblock content %}
password_reset_confirm.html:
{% extends "blog/base.html" %}
{% load crispy_forms_tags %}
{% block content %}
<div class="content-section">
<form method="POST">
{% csrf_token %}
<fieldset class="form-group">
<legend class="border-bottom mb-4">Reset Password</legend>
{{ form|crispy }}
</fieldset>
<div class="form-group">
<button class="btn btn-outline-info" type="submit">Reset Password</button>
</div>
</form>
</div>
{% endblock content %}
password_reset_complete.html:
{% extends "blog/base.html" %}
{% block content %}
<div class="alert alert-info">
Your password has been set.
</div>
Sign In Here
{% endblock content %}

Related

NoReverseMatch at /account/login/ (Trying to use Class based authentication views)

I am trying to use Django's class based authentication views and am getting the following error when attempting to access the login view:
NoReverseMatch at /account/login/
Reverse for 'register' not found. 'register' is not a valid view function or pattern name.
Error during template rendering
In template /Users/justin/Desktop/Programming/Python/django_book/social/website/account/templates/base.html, error at line 0
All authentication templates are stored at account/templates/registration/ and dashboard.html is stored at account/templates/account/, here is the code:
account/urls.py:
from django.urls import path
from . import views
from django.contrib.auth import views as auth_views
urlpatterns = [
path('', views.dashboard, name = 'dashboard'),
path('login/', auth_views.LoginView.as_view(), name = 'login'),
path('logout/', auth_views.LogoutView.as_view(), name = 'logout'),
]
login.html:
{% extends "base.html" %}
{% block title %}Log-in{% endblock %}
{% block content %}
<h1>Log-in</h1>
{% if form.errors %}
<p>
Your username and password didn't match.
Please try again.
</p>
{% else %}
<p>Please, use the following form to log-in. If you don't have an account register here</p>
{% endif %}
<div class="login-form">
<form action="{% url 'login' %}" method="post">
{{ form.as_p }}
{% csrf_token %}
<input type="hidden" name="next" value="{{ next }}" />
<p><input type="submit" value="Log-in"></p>
</form>
</div>
{% endblock %}
base.html:
{% load static %}
<!DOCTYPE html>
<html>
<head>
<title>{% block title%}{% endblock %}</title>
<link rel="stylesheet" href="{% static 'css/base.css' %}">
</head>
<body>
<div id="header">
<span class = 'logo'>Bookmarks</span>
{% if request.user.is_authenticated %}
<ul class = 'menu'>
<li {% if section == "dashboard" %}class="selected"{% endif %}>
My dashboard
</li>
<li {% if section == "images" %}class="selected"{% endif %}>
Images
</li>
<li {% if section == "people" %}class="selected"{% endif %}>
People
</li>
</ul>
{% endif %}
<span class = 'user'>
{% if request.user.is_authenticated %}
Hello {{ request.user.first_name }},
Logout
{% else %}
Login
{% endif %}
</span>
</div>
<div id="content">
{% block content %}
{% endblock %}
</div>
</body>
</html>
Note sure if this is needed but the account/views.py with the dashboard view:
from django.contrib.auth.decorators import login_required
#login_required
def dashboard(request):
return render(request,
'account/dashboard.html',
{'section': 'dashboard'})
and dashboard.html:
{% extends "base.html" %}
{% block title %}Dashboard{% endblock %}
{% block content %}
<h1>Dashboard</h1>
<p>Welcome to your dashboard.</p>
{% endblock %}
I am following the book 'Django 2 By Example' and at this point I believe I have directly copy and pasted the code from here (https://github.com/PacktPublishing/Django-2-by-Example/tree/master/Chapter04) to try and fix this error, but I am still getting. I should note that I am using Django 3.2.6 and am not sure if this is causing it. Thanks for any help with this.

PasswordChangeView not redirecting to PasswordChangeDoneView (or changing the password)

I am trying to use the Django authentication views. My login/logout views are working without a problem.
urls.py:
from django.urls import path
from django.contrib.auth import views as auth_views
from account import views
urlpatterns = [
path('', views.dashboard, name = 'dashboard'),
path('login/', auth_views.LoginView.as_view(), name = 'login'),
path('logout/', auth_views.LogoutView.as_view(), name = 'logout'),
path('password_change', auth_views.PasswordChangeView.as_view(), name = 'password_change'),
path('password_change/done', auth_views.PasswordChangeDoneView.as_view(), name = 'password_change_done'),
]
password_change_form.html:
{% block body %}
<h1>Change your password</h1>
<p>Please use the following form to change your password:</p>
<div class = 'password-change-form'>
<form class="" action="{% url 'login' %}" method="post">
{{ form.as_p }}
{% csrf_token %}
<input type="submit" name="" value="Change">
</form>
</div>
{% endblock %}
password_change_done.html:
{% block body %}
<h1>Password Changed Successfully</h1>
{% endblock %}
I can navigate to /password_change and see the form, but when I fill it in and submit it in I am redirected to /login (I have made sure I was already logged in) and the password does not change. Does anyone know what the issue is?
This is because you specified {% url 'login' %} for the action="…" parameter, you need to change it with:
{% block body %}
<h1>Change your password</h1>
<p>Please use the following form to change your password:</p>
<div class = 'password-change-form'>
<form class="" action="{% url 'password_change' %}" method="post">
{{ form.as_p }}
{% csrf_token %}
<input type="submit" name="" value="Change">
</form>
</div>
{% endblock %}

Login \ Registration redirection

I created login\registration form for user. My problem is that when I login I get an error:
Page not found (404) Request Method: GET Request
URL: http://127.0.0.1:8000/accounts/profile/
If login is successful it should redirect me to "home.html". If I login I came to an error above and if I hit "Back" button in browser I am redirected on my "Home.html" and I am successfully logged in.
My other problem is that when I loggout I am redirected to DJANGO default logout page instead of mine "logged_out.html".
Views.py
#login_required
def home(request):
return render(request, 'home.html')
def signup(request):
if request.method == 'POST':
form = UserCreationForm(request.POST)
if form.is_valid():
form.save()
username = form.cleaned_data.get('username')
raw_password = form.cleaned_data.get('password1')
user = authenticate(username=username, password=raw_password)
login(request, user)
return redirect('home')
else:
form = UserCreationForm()
return render(request, 'signup.html', {'form': form})
Urls.py
urlpatterns = [
path('admin/', admin.site.urls),
url(r'^$', views.home, name='home'),
url(r'^login/$', auth_views.LoginView.as_view(), {'template_name': 'login.html'}, name='login'),
url(r'^logout/$', auth_views.LogoutView.as_view(), {'next_page': 'login'}, name='logout'),
url(r'^signup/$', views.signup, name='signup'),
]
login.html
{% extends 'base.html' %}
{% block content %}
<h2>Log in to My Site</h2>
{% if form.errors %}
<p style="color: red">Your username and password didn't match. Please try again.</p>
{% endif %}
<form method="post">
{% csrf_token %}
<input type="hidden" name="next" value="{{ next }}" />
{% for field in form %}
<p>
{{ field.label_tag }}<br>
{{ field }}<br>
{% for error in field.errors %}
<p style="color: red">{{ error }}</p>
{% endfor %}
{% if field.help_text %}
<p><small style="color: grey">{{ field.help_text }}</small></p>
{% endif %}
</p>
{% endfor %}
<button type="submit">Log in</button>
New to My Site? Sign up
</form>
{% endblock %}
logged_out.html
{% extends 'base.html' %}
{% block content %}
<h2>Why are You leaving :(</h2>
{% endblock %}
base.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>{% block title %}Simple is Better Than Complex{% endblock %}</title>
</head>
<body>
<header>
<h1>My Site</h1>
{% if user.is_authenticated %}
logout
{% else %}
login / signup
{% endif %}
<hr>
</header>
<main>
{% block content %}
{% endblock %}
</main>
</body>
</html>
home.html
{% extends 'base.html' %}
{% block content %}
<h2>Welcome, {{ user.username }}!</h2>
{% if request.user.is_staff %}
link to admin panel
<!--Admin-->
{% endif %}
{% endblock %}
LOGIN_REDIRECT_URL = '/'
you need to put this in your settings.py file as you are using django's inbuilt login system, Django always looks for a url 'profile'

No Post matches the given query

I am using Django version 2.
I am working on a blog web app using PostgreSQL database.
I am trying to add a search feature to the web app but when I open the url (http://localhost:8000/search/) to make a search, I get the error below.
Page not found (404)
Request Method: GET
Request URL: http://localhost:8000/search/
Raised by: blog.views.post_detail
No Post matches the given query.
here is the blog/urls.py
from django.contrib.postgres.search import SearchVector
from .forms import CommentForm, SearchForm
from .models import Post, Comment
from django.shortcuts import render, get_object_or_404
from django.urls import path
from . import views
urlpatterns = [
path('', views.PostListView.as_view(), name='home'),
path('<slug:post>/', views.post_detail, name='post_detail'),
path('<int:post_id>/share', views.post_share, name='share'),
path('search/', views.post_search, name='post_search'),
]
here is the views.py
def post_detail(request, post):
post = get_object_or_404(Post, slug=post)
comments = post.comments.filter(active=True)
new_comment = None
if request.method == 'POST':
comment_form = CommentForm(data=request.POST)
if comment_form.is_valid():
new_comment = comment_form.save(commit=False)
new_comment.post = post
new_comment.save()
else:
comment_form = CommentForm()
return render(request, 'detail.html', {'post': post,
'comments': comments, 'new_comment':
new_comment,'comment_form': comment_form})
def post_search(request):
form = SearchForm()
query = None
results = []
if 'query' in request.GET:
form = SearchForm(request.GET)
if form.is_valid():
query = form.cleaned_data['query']
results = Post.objects.annotate(
search=SearchVector('title','body'),
).filter(search=query)
return render(request, 'search.html',
{'form':form,'query':query,'results':results})
Here are the templates files.
For search.html -(page to make query)
{% extends 'base.html' %}
{% block title %}Search{% endblock title %}
{% block page_title %}Search Posts{% endblock page_title %}
{% block content %}
{% if query %}
<h1>Posts containing "{{ query }}"</h1>
<h3>
{% with results.count as total_results %}
Found {{ total_results }} result{{ total_results|pluralize }}
{% endwith %}
</h3>
{% for post in results %}
<h4>{{ post.title }}</h4>
{{ post.body|truncatewords:5 }}
{% empty %}
<p>There is no results for your query.</p>
{% endfor %}
<p>Search again</p>
{% else %}
<h1>Search for posts</h1>
<form action="." method="GET">
{{ form.as_p }}
<input type="submit" value="Search">
</form>
{% endif %}
{% endblock content %}
For the html for post_detail
{% extends 'base.html' %}
{% load blog_tags %}
{% load crispy_forms_tags %}
{% load profanity %}
{% block title %}{{post.title}}{% endblock title %}
{% block navlink %}
<nav>
<ul>
<li class="current">Home</li>
<li>About</li>
<li >Services</li>
</ul>
</nav>
{% endblock navlink %}
{% block page_title %}{{post.title}}{% endblock page_title %}
{% block content %}
{{post.body|markdown}}
<p>Share this post via email</p>
{% with comments.count as total_comments %}
<h2>{{ total_comments }} comment{{ total_comments|pluralize }} </h2>
{% endwith %}
<div class="container">
{% for comment in comments %}
<div class="comment">
<p>Comment {{ forloop.counter }} by <em>{{ comment.name }}</em> - {{comment.created}} </p>
{{ comment.body|censor|linebreaks }}
</div>
{% empty %}
<p>There are no comments yet.</p>
{% endfor %}
{% if new_comment %}
<h2>Your comment has been added</h2>
{% else %}
<h2>Add a new comment</h2>
<form method="post">{% csrf_token %}
{{comment_form|crispy}}
<input class="button_1" type="submit" value="Add comment">
</form>
{% endif %}
</div>
{% endblock content %}
This is probably for one of the strange reason search is here actually matches with slug:post. One of easiest solution for your problem is to re-order urls and make sure /search place before. Like following
urlpatterns = [
path('', views.PostListView.as_view(), name='home'),
path('search/', views.post_search, name='post_search'),
path('<slug:post>/', views.post_detail, name='post_detail'),
path('<int:post_id>/share', views.post_share, name='share')
]
My suggestion for further developement whenever its need to add slug in url we need to make sure there is some prefix before it.

using django authentication password_reset_confirm error

I have an error with password reset. If I attempt to reset using an invalid email I get the password reset sent notice. If I use a valid email I get NoReverseMatch error message
from django.conf.urls import url
from django.contrib import admin
from . import views
from django.contrib.auth import views as auth_views
from django.urls import reverse, reverse_lazy, resolve
# Password URL's ###################################################################################################
url(r'^change-password/$', views.change_password, name='change_password'),
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'
),
url(r'^password_reset_done/',
auth_views.PasswordResetDoneView.as_view(
),
name='password_reset_done'
),
url(r'^password_reset_confirm/(?P<uidb64>[0-9A-Za-z]+)-(?P<token>.+)/$',
auth_views.PasswordResetConfirmView.as_view(
template_name="registration/password_reset_confirm.html",
success_url=reverse_lazy("partners:password_reset_complete"), # might be required
),
name='password_reset_confirm'
),
url(r'^password_reset_complete/$',auth_views.PasswordResetCompleteView.as_view(), name="password_reset_complete"),
]
Please see my screen grabs for my project structure and the error message
project structure
error message received
{% block head %}
<meta charset="UTF-8">
<title>Welcome ! You can login here !</title>
{% endblock head %}
{% block body %}
{% block content %}
<div class="container">
<div class="row">
<div class="col-sm-6 col-md-3">
<h3>Password Reset Email</h3>
<p>Provide your registered email address </p>
{% autoescape off %}
To initiate the password reset process for your {{ user.get_username }} TestSite Account,
click the link below:
{{ protocol }}://{{ domain }}{% url 'partners:password_reset_confirm' uidb64=uid token=token %}
If clicking the link above doesn't work, please copy and paste the URL in a new browser
window instead.
Sincerely,
The AV's BlogTeam
{% endautoescape %}
</div>
</div>
</div>
{% endblock content %}
{% endblock body %}
I am building this in a "partners app" where I have templates/registration with the above password_reset_confirm.html
Password reset email is as below
{% load i18n %}{% autoescape off %}
{% blocktrans %}You're receiving this email because you requested a password reset for your user account at {{ site_name }}.{% endblocktrans %}
{% trans "Please go to the following page and choose a new password:" %}
{% block reset_link %}
{{ protocol }}://{{ domain }}{% url 'partners:password_reset_confirm' uidb64=uid token=token %}
{% endblock %}
{% trans "Your username, in case you've forgotten:" %} {{ user.get_username }}
{% trans "Thanks for using our site!" %}
{% blocktrans %}The {{ site_name }} team{% endblocktrans %}
{% endautoescape %}
PLEASE HELP
If you want Django to use the template from your partners app, you need to move partners above django.contrib.admin in your INSTALLED_APPS setting.
I would suggest that you move the password reset urls into a urls.py that does not use the partners namespace. Using {% url 'partners:password_reset_confirm' ... %} will fix this specific error, but there are several other places that you will have to make changes to use the namespace, and I don't think it's worth the effort.