mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Closes #5990: Deprecated display_field parameter for custom script ObjectVar and MultiObjectVar fields
This commit is contained in:
@@ -170,18 +170,13 @@ Similar to `ChoiceVar`, but allows for the selection of multiple choices.
|
||||
A particular object within NetBox. Each ObjectVar must specify a particular model, and allows the user to select one of the available instances. ObjectVar accepts several arguments, listed below.
|
||||
|
||||
* `model` - The model class
|
||||
* `display_field` - The name of the REST API object field to display in the selection list (default: `'name'`)
|
||||
* `display_field` - The name of the REST API object field to display in the selection list (default: `'display'`)
|
||||
* `query_params` - A dictionary of query parameters to use when retrieving available options (optional)
|
||||
* `null_option` - A label representing a "null" or empty choice (optional)
|
||||
|
||||
The `display_field` argument is useful when referencing a model which does not have a `name` field. For example, when displaying a list of device types, you would likely use the `model` field:
|
||||
|
||||
```python
|
||||
device_type = ObjectVar(
|
||||
model=DeviceType,
|
||||
display_field='model'
|
||||
)
|
||||
```
|
||||
!!! warning
|
||||
The `display_field` parameter is now deprecated, and will be removed in NetBox v2.12. All ObjectVar instances will
|
||||
instead use the new standard `display` field for all serializers (introduced in NetBox v2.11).
|
||||
|
||||
To limit the selections available within the list, additional query parameters can be passed as the `query_params` dictionary. For example, to show only devices with an "active" status:
|
||||
|
||||
|
@@ -84,6 +84,7 @@ The ObjectChange model (which is used to record the creation, modification, and
|
||||
|
||||
* [#1638](https://github.com/netbox-community/netbox/issues/1638) - Migrate all primary keys to 64-bit integers
|
||||
* [#5873](https://github.com/netbox-community/netbox/issues/5873) - Use numeric IDs in all object URLs
|
||||
* [#5990](https://github.com/netbox-community/netbox/issues/5990) - Deprecated `display_field` parameter for custom script ObjectVar and MultiObjectVar fields
|
||||
|
||||
### REST API Changes
|
||||
|
||||
|
Reference in New Issue
Block a user