From 06871405b1f604fa723d68156f36a51f1f39f93d Mon Sep 17 00:00:00 2001 From: thatmattlove Date: Sat, 28 Aug 2021 09:46:48 -0700 Subject: [PATCH] Revert changes from d0208d4 --- docs/customization/custom-scripts.md | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/docs/customization/custom-scripts.md b/docs/customization/custom-scripts.md index a3c7adc9a..a27bcab83 100644 --- a/docs/customization/custom-scripts.md +++ b/docs/customization/custom-scripts.md @@ -171,7 +171,6 @@ A particular object within NetBox. Each ObjectVar must specify a particular mode * `model` - The model class * `query_params` - A dictionary of query parameters to use when retrieving available options (optional) -* `filter_fields` - A dictionary or list of dictionaries that define a related field (optional) * `null_option` - A label representing a "null" or empty choice (optional) 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: @@ -185,9 +184,7 @@ device = ObjectVar( ) ``` -Multiple values can be specified by assigning a list to the dictionary key. - -It is also possible to reference the value of other fields in the form by using the `filter_fields` attribute. For example, to only show sites matching the selected region: +Multiple values can be specified by assigning a list to the dictionary key. It is also possible to reference the value of other fields in the form by prepending a dollar sign (`$`) to the variable's name. ```python region = ObjectVar( @@ -195,15 +192,12 @@ region = ObjectVar( ) site = ObjectVar( model=Site, - filter_fields={ - 'accessor': 'region_id', - 'field_name': 'region', + query_params={ + 'region_id': '$region' } ) ``` -In this example, `accessor` refers to the `region_id` field on the `Site` model, and `field_name` refers to form field name of the `Region` model. - ### MultiObjectVar Similar to `ObjectVar`, but allows for the selection of multiple objects.