Итак, я пытаюсь реализовать функцию смены пароля, используя встроенные представления на основе классов (PasswordChangeView и PasswordChangeDoneView).Теперь, когда я ввожу старый пароль, новый пароль и подтверждаю поля пароля во встроенном шаблоне и нажимаю клавишу ввода (или отправляю), я получаю сообщение об ошибке «Нет обратного совпадения», говорящее «Обратный путь для« password_change_done »не найден.« Password_change_done »не является допустимой функцией просмотра или именем шаблона. "Я много исследовал и обнаружил, что это потому, что я использую пространство имен приложения (app_name = 'authenticationApp' в urls.py), поэтому django не может найти обратное.Мой простой вопрос: как я могу сообщить встроенному представлению, что он должен использовать URL-адрес в пространстве имен в обратной функции?
PS: я знаю, что использование моего собственного шаблона решит проблему.Редактировать 1:
Environment:
Request Method: POST
Request URL: http://localhost:8000/password_change/
Django Version: 2.1.1
Python Version: 3.6.7
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'authenticationApp.apps.AuthenticationappConfig']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']
Traceback:
File "/home/python/Desktop/environments/second/lib/python3.6/site-packages/django/core/handlers/exception.py" in inner
34. response = get_response(request)
File "/home/python/Desktop/environments/second/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
126. response = self.process_exception_by_middleware(e, request)
File "/home/python/Desktop/environments/second/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
124. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/python/Desktop/environments/second/lib/python3.6/site-packages/django/views/generic/base.py" in view
68. return self.dispatch(request, *args, **kwargs)
File "/home/python/Desktop/environments/second/lib/python3.6/site-packages/django/utils/decorators.py" in _wrapper
45. return bound_method(*args, **kwargs)
File "/home/python/Desktop/environments/second/lib/python3.6/site-packages/django/views/decorators/debug.py" in sensitive_post_parameters_wrapper
76. return view(request, *args, **kwargs)
File "/home/python/Desktop/environments/second/lib/python3.6/site-packages/django/utils/decorators.py" in _wrapper
45. return bound_method(*args, **kwargs)
File "/home/python/Desktop/environments/second/lib/python3.6/site-packages/django/utils/decorators.py" in _wrapped_view
142. response = view_func(request, *args, **kwargs)
File "/home/python/Desktop/environments/second/lib/python3.6/site-packages/django/utils/decorators.py" in _wrapper
45. return bound_method(*args, **kwargs)
File "/home/python/Desktop/environments/second/lib/python3.6/site-packages/django/contrib/auth/decorators.py" in _wrapped_view
21. return view_func(request, *args, **kwargs)
File "/home/python/Desktop/environments/second/lib/python3.6/site-packages/django/contrib/auth/views.py" in dispatch
338. return super().dispatch(*args, **kwargs)
File "/home/python/Desktop/environments/second/lib/python3.6/site-packages/django/views/generic/base.py" in dispatch
88. return handler(request, *args, **kwargs)
File "/home/python/Desktop/environments/second/lib/python3.6/site-packages/django/views/generic/edit.py" in post
142. return self.form_valid(form)
File "/home/python/Desktop/environments/second/lib/python3.6/site-packages/django/contrib/auth/views.py" in form_valid
350. return super().form_valid(form)
File "/home/python/Desktop/environments/second/lib/python3.6/site-packages/django/views/generic/edit.py" in form_valid
57. return HttpResponseRedirect(self.get_success_url())
File "/home/python/Desktop/environments/second/lib/python3.6/site-packages/django/views/generic/edit.py" in get_success_url
51. if not self.success_url:
File "/home/python/Desktop/environments/second/lib/python3.6/site-packages/django/utils/functional.py" in __wrapper__
108. res = func(*self.__args, **self.__kw)
File "/home/python/Desktop/environments/second/lib/python3.6/site-packages/django/urls/base.py" in reverse
90. return iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs))
File "/home/python/Desktop/environments/second/lib/python3.6/site-packages/django/urls/resolvers.py" in _reverse_with_prefix
622. raise NoReverseMatch(msg)
Exception Type: NoReverseMatch at /password_change/
Exception Value: Reverse for 'password_change_done' not found. 'password_change_done' is not a valid view function or pattern name.