[Answered ]-Django Custom Model, Email Field disable for filling when Create User by Admin

1👍

Your admin class AccountAdmin inherits from UserAdmin. If you check it’s implementation it sets add_form = UserCreationForm, which has the following line [Github code] in it’s Meta class: fields = ("username",).

Since you already have made a custom form inheriting from UserCreationForm you should set that in your admin class:

from .forms import RegisterationForm


class AccountAdmin(UserAdmin):
    ...
    #              Remove ↓
    readonly_fields = ('email', 'date_joined', 'last_login')
    ...
    add_form = RegisterationForm

Leave a comment