|
@@ -18,7 +18,6 @@ __all__ = (
|
|
|
'DateTimePicker',
|
|
'DateTimePicker',
|
|
|
'NumericArrayField',
|
|
'NumericArrayField',
|
|
|
'SelectSpeedWidget',
|
|
'SelectSpeedWidget',
|
|
|
- 'SelectWithDisabled',
|
|
|
|
|
'SelectWithPK',
|
|
'SelectWithPK',
|
|
|
'SlugWidget',
|
|
'SlugWidget',
|
|
|
'SmallTextarea',
|
|
'SmallTextarea',
|
|
@@ -76,18 +75,12 @@ class BulkEditNullBooleanSelect(forms.NullBooleanSelect):
|
|
|
self.attrs['class'] = 'netbox-static-select'
|
|
self.attrs['class'] = 'netbox-static-select'
|
|
|
|
|
|
|
|
|
|
|
|
|
-class SelectWithDisabled(forms.Select):
|
|
|
|
|
- """
|
|
|
|
|
- Modified the stock Select widget to accept choices using a dict() for a label. The dict for each option must include
|
|
|
|
|
- 'label' (string) and 'disabled' (boolean).
|
|
|
|
|
- """
|
|
|
|
|
- option_template_name = 'widgets/selectwithdisabled_option.html'
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-class StaticSelect(SelectWithDisabled):
|
|
|
|
|
|
|
+class StaticSelect(forms.Select):
|
|
|
"""
|
|
"""
|
|
|
A static <select/> form widget which is client-side rendered.
|
|
A static <select/> form widget which is client-side rendered.
|
|
|
"""
|
|
"""
|
|
|
|
|
+ option_template_name = 'widgets/select_option.html'
|
|
|
|
|
+
|
|
|
def __init__(self, *args, **kwargs):
|
|
def __init__(self, *args, **kwargs):
|
|
|
super().__init__(*args, **kwargs)
|
|
super().__init__(*args, **kwargs)
|
|
|
|
|
|
|
@@ -99,8 +92,6 @@ class StaticSelectMultiple(StaticSelect, forms.SelectMultiple):
|
|
|
def __init__(self, *args, **kwargs):
|
|
def __init__(self, *args, **kwargs):
|
|
|
super().__init__(*args, **kwargs)
|
|
super().__init__(*args, **kwargs)
|
|
|
|
|
|
|
|
- self.attrs['data-multiple'] = 1
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
class SelectWithPK(StaticSelect):
|
|
class SelectWithPK(StaticSelect):
|
|
|
"""
|
|
"""
|
|
@@ -133,13 +124,13 @@ class ClearableFileInput(forms.ClearableFileInput):
|
|
|
template_name = 'widgets/clearable_file_input.html'
|
|
template_name = 'widgets/clearable_file_input.html'
|
|
|
|
|
|
|
|
|
|
|
|
|
-class APISelect(SelectWithDisabled):
|
|
|
|
|
|
|
+class APISelect(forms.Select):
|
|
|
"""
|
|
"""
|
|
|
A select widget populated via an API call
|
|
A select widget populated via an API call
|
|
|
|
|
|
|
|
:param api_url: API endpoint URL. Required if not set automatically by the parent field.
|
|
:param api_url: API endpoint URL. Required if not set automatically by the parent field.
|
|
|
"""
|
|
"""
|
|
|
-
|
|
|
|
|
|
|
+ option_template_name = 'widgets/select_option.html'
|
|
|
dynamic_params: Dict[str, str]
|
|
dynamic_params: Dict[str, str]
|
|
|
static_params: Dict[str, List[str]]
|
|
static_params: Dict[str, List[str]]
|
|
|
|
|
|