I have logged in to admin panel as superuser, I want to create new user through admin panel , After creating new user with raw password is not hashing in admin panel. Its showing raw password. How to hash the password while creating user through admin panel?
override password method, In admin.py
class PasswordUserAdmin(admin.ModelAdmin):
def save_model(self, request, obj, form, change):
obj.password= make_password(obj.password)
obj.user = request.user
obj.save()
add this class in site.register
admin.site.register(User, PasswordUserAdmin)