Drop backward compatibility for specifying queryset on custom script ObjectVar, MultiObjectVar #4671

Closed
opened 2025-12-29 19:19:20 +01:00 by adam · 0 comments
Owner

Originally created by @jeremystretch on GitHub (Mar 16, 2021).

Originally assigned to: @jeremystretch on GitHub.

Proposed Changes

Drop backward compatibility for the queryset keyword argument for custom script ObjectVar and MultiObjectVar field types. These fields should be initialized using the model keyword instead. For example,

device1 = ObjectVar(
    queryset=Device.objects.all()
)

becomes:

device1 = ObjectVar(
    model=Device
)

Justification

NetBox currently issues a warning when initializing these fields with queryset, and its use is deprecated. The model parameter was introduced to eliminate confusion regarding filter of available options (which should be done using the query_params parameter).

Originally created by @jeremystretch on GitHub (Mar 16, 2021). Originally assigned to: @jeremystretch on GitHub. ### Proposed Changes Drop backward compatibility for the `queryset` keyword argument for custom script ObjectVar and MultiObjectVar field types. These fields should be initialized using the `model` keyword instead. For example, ``` device1 = ObjectVar( queryset=Device.objects.all() ) ``` becomes: ``` device1 = ObjectVar( model=Device ) ``` ### Justification NetBox currently issues a warning when initializing these fields with `queryset`, and its use is deprecated. The `model` parameter was introduced to eliminate confusion regarding filter of available options (which should be done using the `query_params` parameter).
adam added the status: acceptedtype: deprecation labels 2025-12-29 19:19:20 +01:00
adam closed this issue 2025-12-29 19:19:20 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#4671