This is my form
class LoginForm(ModelForm):
class Meta:
model = Login
fields = '__all__'
widgets = {
'password': PasswordInput(),
}
This is my inline
class LoginInline(admin.StackedInline):
model = Login
This is my admin
class AppAdmin(admin.ModelAdmin):
list_display = ('name', 'link_href')
inlines = [LoginInline]
class LoginAdmin(admin.ModelAdmin):
form = LoginForm
When I try to add login from login page, the password is correctly applied
But not from the app page using inline
How can I fix this ? I thought of adding another form for AppAdmin
but the password field does not exist in App
model only in Login
model and I would like to know if there is a way to reference it inside another form
CodePudding user response:
I didn't test, but this should do it
class LoginInline(admin.StackedInline):
form = LoginForm
model = Login