Admin broken for subclasses of User
|Reported by:||garrison||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
I have a model called Teacher, which inherits from django.contrib.auth.models.User.
Here's the story: the "Add Teacher" form in the admin uses the form typically used for editing a user, so you have to type in a fake password string for it to accept the new Teacher. Further, the link to the "change password form" is broken.
Nothing I have said so far is new, however, as this is the subject of ticket #9656. This ticket was closed, saying that the person ought to be subclassing from django.contrib.auth.admin.UserAdmin anyway.
I am filing this ticket because such subclassing from UserAdmin creates additional problems that are even worse than the above issues. In particular,
- If you submit the "Add Teacher" form, a User is created, but a corresponding Teacher is not.
- After editing a Teacher, it redirects to the edit page for "teacher/[id]/", except it uses the id from the User table, not the Teacher table. I have only been able to reproduce this using MySQL; sqlite does not give me this error.
In short, deriving from UserAdmin currently creates more problems than it solves.