Hi,

this is native django 4.2 code:

*admin/login.html*

...

<form action="{{ app_path }}" method="post" id="login-form">{% csrf_token %}

  ...

  {% url '*admin_password_reset*' as password_reset_url %}

  {% if password_reset_url %}

  <div class="password-reset-link">

    <a href="{{ password_reset_url }}">{% translate 'Forgotten your 
password or username?' %}</a>

  </div>

  {% endif %}

  ...

</form>

...

 

*auth/urls.py:*

urlpatterns = [

    ...

    path("password_reset/", views.PasswordResetView.as_view 
<http://views.passwordresetview.as_view/>(), name="*password_reset*"),

    ...

]

In template is expected *admin_password_reset *but auth module generates 
*password_reset*.
This is my project urls.py:
urlpatterns = []

if settings.DEBUG:
    urlpatterns += [
        path('__debug__/', include(debug_toolbar.urls)),
        *static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT),
    ]

urlpatterns += [
    # API
    # path('api/ ', include('apps.management.api_urls')),

    # extra pages
    path('changelog/', management_views.changelog, name='changelog'),

    # (due to password reset)
    path('accounts/', include('django.contrib.auth.urls')),
    *path('accounts/password_reset/', PasswordResetView.as_view(), 
name='admin_password_reset'),*

    # modules
    path('authentication/', include('apps.authentication.urls')),
    path('management/', include('apps.management.urls')),

    # native admin URLs
    path('', admin.site.urls),  # must be last if admin URL is empty!
]

Notice that I had to add the extra
 
*path('accounts/password_reset/', PasswordResetView.as_view(), 
name='admin_password_reset'),*to display the reset password link. Is this 
on purpose in django or is this bug that should be fixed?


Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/24afc193-c22a-4be8-9f3b-14315b2b7a8bn%40googlegroups.com.
  • Pas... Marty
    • ... 'Adam Johnson' via Django developers (Contributions to Django itself)

Reply via email to