Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow each DataObject subclass to define its own formfield when autoscaffolded from relation #11079

Open
GuySartorelli opened this issue Nov 29, 2023 · 1 comment

Comments

@GuySartorelli
Copy link
Member

GuySartorelli commented Nov 29, 2023

Currently, we have the following hard-coded logic for autoscaffolding relations:

  • has_one relations are autoscaffolded as one of:
    • DropdownField if there's less than a configurable threshold
    • NumericField if there's more than a configurable threshold
    • FileHandleField (usually UploadField) if it's a file or image
  • has_many and many_many relations are autoscaffolded as GridField fields inside a tab.

Some models have specific form fields they should be used with. For example, a Link model might have a specific LinkField for has_one and MultiLinkField for has_many relations.
Currently, adding the form fields for these models often requires first removing the original autoscaffolded field. It would be way better if it just autoscaffolded the correct field from the start.

We should allow each model to instantiate its own form field when being autoscaffolded from a relation.

Acceptance criteria

  • The current default logic still applies (i.e. no breaking changes)
  • Any model can pre-define its own autoscaffolded form field
@mooror
Copy link
Contributor

mooror commented Nov 30, 2023

This would be a marvelous addition to the DataObject infrastructure 💯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants