Redirected to admin reset_password and change_password template instead of my app template

24 Views Asked by At

I use Django registration and override reset_password and change_password views.

But it works in all my projects except my last project where I'm redirected to admin templates instead of my own templates.

Django 2.2.5/Docker

settings.py

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.sites',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',

    'registration.apps.RegistrationConfig',  
]
urlpatterns = [
    path('authentification/', include('registration.urls')),
    path('registration/', include('django.contrib.auth.urls')),
] 
app_name='registration'
urlpatterns = [
    path('password_reset/', views.ResetPasswordView.as_view(success_url="/registration/login/"), name='password_reset'),
    path('password_change/', views.CustomPasswordChangeView.as_view(), name='password_change'),
]
class ResetPasswordView(SuccessMessageMixin, PasswordResetView):

    template_name = 'registration/password_reset_form.html'
    ...
    success_url = reverse_lazy('home')

class CustomPasswordChangeView(SuccessMessageMixin, PasswordChangeView):

    form_class = CustomPasswordChangeForm
    template_name = 'registration/password_change_form.html'
    success_url = reverse_lazy('home')
0

There are 0 best solutions below