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

Closes #12988: Introduce custom field choice sets #13195

Merged
merged 12 commits into from
Jul 19, 2023

Conversation

jeremystretch
Copy link
Member

Fixes: #12988

  • Introduce the new CustomFieldChoiceSet model
  • Automatically migrate all CF choices to the new model
  • Add a choice_set ForeignKey to CustomField and remove the choices array field
  • Introduce ArrayWidget to improve UX while editing choices

Copy link
Member

@DanSheps DanSheps left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line separated appears to have issues when used on Windows clients. Quick and dirty fix is to replace CRLF with LF only.

netbox/extras/models/customfields.py Outdated Show resolved Hide resolved
netbox/extras/forms/model_forms.py Outdated Show resolved Hide resolved
docs/customization/custom-fields.md Show resolved Hide resolved
docs/models/extras/customfieldchoiceset.md Show resolved Hide resolved
netbox/extras/forms/bulk_import.py Show resolved Hide resolved
@jeremystretch
Copy link
Member Author

Thanks @DanSheps. I'm going to hold off on the documentation updates as I'll need to rewrite the descriptions for extra_fields for #12194 anyway.

Copy link
Collaborator

@arthanson arthanson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also noticed when you add a custom field "Choice set" is only valid if you have selection type - we should add a PR to change the form to use HTMX so "Choice Set" is only displayed if you have a selection type.

netbox/extras/forms/filtersets.py Show resolved Hide resolved
netbox/extras/forms/model_forms.py Show resolved Hide resolved
netbox/extras/models/customfields.py Outdated Show resolved Hide resolved
netbox/extras/models/customfields.py Show resolved Hide resolved
@jeremystretch jeremystretch merged commit 96ea0ac into feature Jul 19, 2023
8 checks passed
@jeremystretch jeremystretch deleted the 12988-custom-field-choice-sets branch July 19, 2023 14:26
@DanSheps
Copy link
Member

Thanks @DanSheps. I'm going to hold off on the documentation updates as I'll need to rewrite the descriptions for extra_fields for #12194 anyway.

Yeah, no problem.

The splitlines() is way better then my solution anyways, and I always forget about it.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants