From 617e1430de94a4a91b90371ed38f9bb00555921e Mon Sep 17 00:00:00 2001 From: jpic Date: Wed, 3 Apr 2024 15:53:27 +0200 Subject: [PATCH] Fix default_url_generator This is the URL that this module defines: dj_rest_auth/urls.py: path('password/reset/confirm/', PasswordResetConfirmView.as_view(), name='rest_password_reset_confirm'), As such, the URL name it should use is rest_password_reset_confirm. Also, remove false documentation, which recommended to define a password_reset_confirm URL "like in the demo" but the demo includes this URL, with rest_password_reset_confirm, not password_reset_confirm: path('password/reset/confirm/', PasswordResetConfirmView.as_view(), name='rest_password_reset_confirm'), --- dj_rest_auth/forms.py | 2 +- docs/faq.rst | 10 ++-------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/dj_rest_auth/forms.py b/dj_rest_auth/forms.py index 4c0efa57..bc637840 100644 --- a/dj_rest_auth/forms.py +++ b/dj_rest_auth/forms.py @@ -21,7 +21,7 @@ def default_url_generator(request, user, temp_key): path = reverse( - 'password_reset_confirm', + 'rest_password_reset_confirm', args=[user_pk_to_url_str(user), temp_key], ) diff --git a/docs/faq.rst b/docs/faq.rst index 575b1800..1c2a637e 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -16,13 +16,7 @@ FAQ If you don't want to use API on that step, then just use ConfirmEmailView view from: django-allauth https://github.com/pennersr/django-allauth/blob/master/allauth/account/views.py - -2. I get an error: Reverse for 'password_reset_confirm' not found. - - You need to add `password_reset_confirm` url into your ``urls.py`` (at the top of any other included urls). Please check the ``urls.py`` module inside demo app example for more details. - - -3. How can I update UserProfile assigned to User model? +2. How can I update UserProfile assigned to User model? Assuming you already have UserProfile model defined like this @@ -42,7 +36,7 @@ FAQ from rest_framework import serializers from dj_rest_auth.serializers import UserDetailsSerializer - + class UserProfileSerializer(serializers.ModelSerializer): class Meta: model = UserProfile