Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom User Change Password Form Issue #392

Closed
workshop22 opened this issue May 17, 2024 · 1 comment
Closed

Custom User Change Password Form Issue #392

workshop22 opened this issue May 17, 2024 · 1 comment

Comments

@workshop22
Copy link

workshop22 commented May 17, 2024

I've created a basic project to test the possibility of using Unfold. All I've done is create an app called Users and set up a CustomUser model but I'm getting 302 errors when trying to navigate to the change password form:

[18/May/2024 10:01:33] "GET /admin/users/customuser/1/password/ HTTP/1.1" 302 0
[18/May/2024 10:01:33] "GET /admin/users/customuser/1/password/change/ HTTP/1.1" 302 0

The change password form works fine if I'm not using a custom user model or if I'm not using Unfold. I'm not sure how to go about fixing the problem.

The object being passed seems to be incorrect attaching /password to it

print(resolve('/admin/users/customuser/1/password/'))
ResolverMatch(func=django.views.generic.base.RedirectView, args=(), kwargs={'object_id': '1/password'}, url_name=None, app_names=['admin'], namespaces=['admin'], route='admin/users/customuser/path:object_id/', captured_kwargs={'object_id': '1/password'})

print(resolve('/admin/users/customuser/1/password/change/'))
ResolverMatch(func=django.contrib.admin.options.change_view, args=(), kwargs={'object_id': '1/password'}, url_name='users_customuser_change', app_names=['admin'], namespaces=['admin'], route='admin/users/customuser/path:object_id/change/', captured_kwargs={'object_id': '1/password'})

As far as I know, I am properly importing from Unfold as stated in the documentation.

Any help would be much appreciated.

@workshop22 workshop22 changed the title Custom User Password Issues Custom User Change Password Form Doesn't Exist May 20, 2024
@workshop22 workshop22 changed the title Custom User Change Password Form Doesn't Exist Custom User Change Password Form Issue May 20, 2024
@workshop22
Copy link
Author

I finally found a fix. I solved the problem by doing this:

class CustomUserAdmin(UserAdmin, ModelAdmin):

Adding UserAdmin fixed the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant