mirror of
https://github.com/netbox-community/netbox.git
synced 2025-12-20 12:22:23 -06:00
Fixes #7153: Allow clearing of assigned device type images
This commit is contained in:
@@ -4,7 +4,7 @@ import re
|
||||
import yaml
|
||||
from django import forms
|
||||
|
||||
from .widgets import APISelect, APISelectMultiple, StaticSelect
|
||||
from .widgets import APISelect, APISelectMultiple, ClearableFileInput, StaticSelect
|
||||
|
||||
|
||||
__all__ = (
|
||||
@@ -29,12 +29,12 @@ class BootstrapMixin(forms.BaseForm):
|
||||
|
||||
exempt_widgets = [
|
||||
forms.CheckboxInput,
|
||||
forms.ClearableFileInput,
|
||||
forms.FileInput,
|
||||
forms.RadioSelect,
|
||||
forms.Select,
|
||||
APISelect,
|
||||
APISelectMultiple,
|
||||
ClearableFileInput,
|
||||
StaticSelect,
|
||||
]
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ __all__ = (
|
||||
'APISelect',
|
||||
'APISelectMultiple',
|
||||
'BulkEditNullBooleanSelect',
|
||||
'ClearableFileInput',
|
||||
'ColorSelect',
|
||||
'ContentTypeSelect',
|
||||
'DatePicker',
|
||||
@@ -135,6 +136,13 @@ class NumericArrayField(SimpleArrayField):
|
||||
return super().to_python(value)
|
||||
|
||||
|
||||
class ClearableFileInput(forms.ClearableFileInput):
|
||||
"""
|
||||
Override Django's stock ClearableFileInput with a custom template.
|
||||
"""
|
||||
template_name = 'widgets/clearable_file_input.html'
|
||||
|
||||
|
||||
class APISelect(SelectWithDisabled):
|
||||
"""
|
||||
A select widget populated via an API call
|
||||
|
||||
Reference in New Issue
Block a user