Skip to content

Choice form field fails extra-inline validation #1466

@alfonsrv

Description

@alfonsrv

When defining an inline with a choices field and having extra = 1 set (to allow easily creating a new instance) and submitting the form, validation fails for the extra added formset because UnfoldAdminSelectWidget does not render the blank choice, causing it to select the first choice automatically.

This seems to cause Django to go through the regular form validation because one of the fields has a value. A workaround is to define default= on the choices field or to not set extra = 0

https://github.com/unfoldadmin/django-unfold/blob/main/src/unfold/mixins/base_model_admin.py#L56-L58

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions