1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Closes #5451: Add support for multiple-selection custom fields

This commit is contained in:
Jeremy Stretch
2021-03-01 14:51:29 -05:00
parent 3f216fa4a3
commit 1ddc1a6781
5 changed files with 33 additions and 7 deletions

View File

@@ -16,6 +16,7 @@ Custom fields must be created through the admin UI under Extras > Custom Fields.
* Date: A date in ISO 8601 format (YYYY-MM-DD)
* URL: This will be presented as a link in the web UI
* Selection: A selection of one of several pre-defined custom choices
* Multiple selection: A selection field which supports the assignment of multiple values
Each custom field must have a name; this should be a simple database-friendly string, e.g. `tps_report`. You may also assign a corresponding human-friendly label (e.g. "TPS report"); the label will be displayed on web forms. A weight is also required: Higher-weight fields will be ordered lower within a form. (The default weight is 100.) If a description is provided, it will appear beneath the field in a form.
@@ -39,6 +40,8 @@ Each custom selection field must have at least two choices. These are specified
If a default value is specified for a selection field, it must exactly match one of the provided choices.
The value of a multiple selection field will always return a list, even if only one value is selected.
## Custom Fields and the REST API
When retrieving an object via the REST API, all of its custom data will be included within the `custom_fields` attribute. For example, below is the partial output of a site with two custom fields defined:

View File

@@ -8,6 +8,7 @@
* [#5370](https://github.com/netbox-community/netbox/issues/5370) - Extend custom field support to organizational models
* [#5401](https://github.com/netbox-community/netbox/issues/5401) - Extend custom field support to device component models
* [#5451](https://github.com/netbox-community/netbox/issues/5451) - Add support for multiple-selection custom fields
### Other Changes