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

Remove brief_mode parameter from DynamicModelChoiceMixin

This commit is contained in:
Jeremy Stretch
2021-03-30 21:34:50 -04:00
parent b91e5763e2
commit a292ff5cc0
2 changed files with 1 additions and 10 deletions

View File

@ -271,20 +271,18 @@ class DynamicModelChoiceMixin:
:param null_option: The string used to represent a null selection (if any)
:param disabled_indicator: The name of the field which, if populated, will disable selection of the
choice (optional)
:param brief_mode: Use the "brief" format (?brief=true) when making API requests (default)
"""
filter = django_filters.ModelChoiceFilter
widget = widgets.APISelect
# TODO: Remove display_field in v2.12
def __init__(self, display_field='display', query_params=None, initial_params=None, null_option=None,
disabled_indicator=None, brief_mode=True, *args, **kwargs):
disabled_indicator=None, *args, **kwargs):
self.display_field = display_field
self.query_params = query_params or {}
self.initial_params = initial_params or {}
self.null_option = null_option
self.disabled_indicator = disabled_indicator
self.brief_mode = brief_mode
# to_field_name is set by ModelChoiceField.__init__(), but we need to set it early for reference
# by widget_attrs()
@ -309,10 +307,6 @@ class DynamicModelChoiceMixin:
if self.disabled_indicator is not None:
attrs['disabled-indicator'] = self.disabled_indicator
# Toggle brief mode
if not self.brief_mode:
attrs['data-full'] = 'true'
# Attach any static query parameters
for key, value in self.query_params.items():
widget.add_query_param(key, value)