Code

Opened 3 years ago

Closed 3 years ago

#16728 closed Bug (invalid)

Registering custom Admin class for User model breaks changing passwords

Reported by: django.bigfudge@… Owned by: nobody
Component: contrib.admin Version: 1.3
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by aaugustin)

I am doing this:

    class UserProfileInline(admin.StackedInline):
        model = UserProfile
    
    
    class UserAdmin(admin.ModelAdmin):
        save_on_top = True
        inlines = [UserProfileInline]        

    admin.site.unregister(User) 
    admin.site.register(User, UserAdmin)

To allow me to edit UserProfiles inline with Users. However, doing this seems to break the password reset feature within django admin (not the user-facing password reset – the one on the User model itself which allows and administrator to set a user's password manually. The error is:

user object with primary key u'3/password' does not exist.

Attachments (0)

Change History (1)

comment:1 Changed 3 years ago by aaugustin

  • Description modified (diff)
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

Indeed, your code doesn't work. You may have more luck if you subclass django.contrib.auth.admin.UserAdmin (I haven't tested).

Anyway, that isn't a bug in Django. Could you use the django-users mailing list or the #django IRC channel for this kind of requests? Trac is the place for reporting bugs, it isn't a support forum. Thanks :)

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.