You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I am trying to pre-select a form field with the value of the null_option. In the following example the default = True results with automatic selection of the first existing view object. I would like to pre-select the "Global" value which resolves to "view=null" query. I can not get the field automatically populated. I have tried with different values assigned to the option "default" with no success. I know that the ObjectVar responds with the model objects existing already in NetBox and there is no "null" objects that the query can respond with. Nevertheless the "null_option", if chosen in the form field (in this case form shows value "Global"), correctly sets view instance to "null" and next form field "Zones" restricts the query to the specified "view". Is there such an option that automatically populates this "view" instance as "null"?
I have also tried to set FILTERS_NULL_CHOICE_VALUE as "Global" in the settings, but I did not get any change in behavior.
view = ObjectVar(
description = "Select the view of the zones you want to update",
model = View,
null_option = "Global",
required = True,
default = True
)
zones = MultiObjectVar(
description = "Select the zones you want to update",
model = Zone,
query_params={
'view_id': '$view'
},
required = True
)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I am trying to pre-select a form field with the value of the null_option. In the following example the
default = True
results with automatic selection of the first existing view object. I would like to pre-select the "Global" value which resolves to "view=null" query. I can not get the field automatically populated. I have tried with different values assigned to the option "default" with no success. I know that the ObjectVar responds with the model objects existing already in NetBox and there is no "null" objects that the query can respond with. Nevertheless the "null_option", if chosen in the form field (in this case form shows value "Global"), correctly sets view instance to "null" and next form field "Zones" restricts the query to the specified "view". Is there such an option that automatically populates this "view" instance as "null"?I have also tried to set FILTERS_NULL_CHOICE_VALUE as "Global" in the settings, but I did not get any change in behavior.
Beta Was this translation helpful? Give feedback.
All reactions