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:
@ -160,9 +160,6 @@ $(document).ready(function() {
|
|||||||
offset: offset,
|
offset: offset,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Allow for controlling the brief setting from within APISelect
|
|
||||||
parameters.brief = ( $(element).is('[data-full]') ? undefined : true );
|
|
||||||
|
|
||||||
// Attach any extra query parameters
|
// Attach any extra query parameters
|
||||||
$.each(element.attributes, function(index, attr){
|
$.each(element.attributes, function(index, attr){
|
||||||
if (attr.name.includes("data-query-param-")){
|
if (attr.name.includes("data-query-param-")){
|
||||||
|
@ -271,20 +271,18 @@ class DynamicModelChoiceMixin:
|
|||||||
:param null_option: The string used to represent a null selection (if any)
|
: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
|
:param disabled_indicator: The name of the field which, if populated, will disable selection of the
|
||||||
choice (optional)
|
choice (optional)
|
||||||
:param brief_mode: Use the "brief" format (?brief=true) when making API requests (default)
|
|
||||||
"""
|
"""
|
||||||
filter = django_filters.ModelChoiceFilter
|
filter = django_filters.ModelChoiceFilter
|
||||||
widget = widgets.APISelect
|
widget = widgets.APISelect
|
||||||
|
|
||||||
# TODO: Remove display_field in v2.12
|
# TODO: Remove display_field in v2.12
|
||||||
def __init__(self, display_field='display', query_params=None, initial_params=None, null_option=None,
|
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.display_field = display_field
|
||||||
self.query_params = query_params or {}
|
self.query_params = query_params or {}
|
||||||
self.initial_params = initial_params or {}
|
self.initial_params = initial_params or {}
|
||||||
self.null_option = null_option
|
self.null_option = null_option
|
||||||
self.disabled_indicator = disabled_indicator
|
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
|
# to_field_name is set by ModelChoiceField.__init__(), but we need to set it early for reference
|
||||||
# by widget_attrs()
|
# by widget_attrs()
|
||||||
@ -309,10 +307,6 @@ class DynamicModelChoiceMixin:
|
|||||||
if self.disabled_indicator is not None:
|
if self.disabled_indicator is not None:
|
||||||
attrs['disabled-indicator'] = self.disabled_indicator
|
attrs['disabled-indicator'] = self.disabled_indicator
|
||||||
|
|
||||||
# Toggle brief mode
|
|
||||||
if not self.brief_mode:
|
|
||||||
attrs['data-full'] = 'true'
|
|
||||||
|
|
||||||
# Attach any static query parameters
|
# Attach any static query parameters
|
||||||
for key, value in self.query_params.items():
|
for key, value in self.query_params.items():
|
||||||
widget.add_query_param(key, value)
|
widget.add_query_param(key, value)
|
||||||
|
Reference in New Issue
Block a user