Skip to content

How to edit foreign key id directly? #1032

@mmzeynalli

Description

@mmzeynalli

Discussed in #1031

Originally posted by teal-clover April 17, 2026
I have User which is tied to Company through "company_id" field.
I don't like default dropdowns bc they get too big if not using ajax feature, but if using ajax feature it seems I cannot set None as value for field.
Here is the code and the admin

class UserAdmin(ModelView, model=User):
    ...
    form_columns = ["email", "company_id"]
image

Edit by @mmzeynalli :

During build-up, we are setting data-allow-blank to 1, but never using it in JS.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions