mirror of
https://github.com/netbox-community/netbox.git
synced 2025-12-21 12:52:21 -06:00
Enable CSV import for custom fields
This commit is contained in:
@@ -442,20 +442,6 @@ class CSVChoiceField(forms.ChoiceField):
|
||||
return self.choice_values[value]
|
||||
|
||||
|
||||
class CSVCustomFieldChoiceField(forms.TypedChoiceField):
|
||||
"""
|
||||
Invert the choice tuples: CSV import takes the human-friendly label as input rather than the database value
|
||||
"""
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
||||
if 'choices' in kwargs:
|
||||
kwargs['choices'] = {
|
||||
label: value for value, label in kwargs['choices']
|
||||
}
|
||||
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
|
||||
class ExpandableNameField(forms.CharField):
|
||||
"""
|
||||
A field which allows for numeric range expansion
|
||||
|
||||
Reference in New Issue
Block a user