I have created a custom user model which I am successfully using within my app.
The problem is that within the Admin, on the user edit screen, I get a display of the present password hash, instead of the very useful interface for setting the password.
I am using Django 1.5b1 on Python 2.7.
How can I convince the Django admin to treat my user model the same way it treats the native User, for the sake of the admin user interface?
Documentation suggest that you need to register the custom model with admin and also define few methods as well so that admin interface works with custom user model.
You may also have to define built-in forms for User.
From Custom users and django.contrib.admin
You will also need to register your custom User model with the admin. If your custom User model extends AbstractUser, you can use Django's existing UserAdmin class. However, if your User model extends AbstractBaseUser, you'll need to define a custom ModelAdmin class.
Just add this to your form:
Borrowed from https://stackoverflow.com/a/15630360/780262
At least in 1.10, I was able to do the following. Simpler than the above. I put it in admin.py:
If you're extending AbstractBaseUser, you'll need two forms, a creation form, and an update form without the passwords, derived from ModelForm.
Then in the Admin form, specify separate create and update forms, along with corresponding fieldsets:
Passwords for new users will work. Do password changes in the pre-defined django form instead of in admin.