Issue
I am using AbstractBaseUser
and UserCreationForm
with my Django app. When registering users through my app, the password gets saved in hash format and saved in the database. But when I try to do the same thing using Django admin site, the password gets saved in raw format.
Solution
You need to make sure that your model admin class knows how to hash passwords. According to the docs, if you are using subclassing AbstractBaseUser
, then you might be able to extend UserAdmin
.
Assuming your custom user model is called CustomUser
, you could try the following.
from django.contrib.auth.admin import UserAdmin
class CustomUserAdmin(UserAdmin):
...
admin.site.register(CustomUser, CustomUserAdmin)
Answered By - Alasdair
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.