mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-18 05:28:16 -06:00
13983 fix escape handling
This commit is contained in:
parent
f509c65f3d
commit
f49c310f23
@ -96,8 +96,6 @@ class CustomFieldChoiceSetImportForm(CSVModelForm):
|
||||
for line in self.cleaned_data['extra_choices']:
|
||||
try:
|
||||
value, label = re.split(r'(?<!\\):', line, maxsplit=1)
|
||||
value = value.replace('\\:', ':')
|
||||
label = label.replace('\\:', ':')
|
||||
except ValueError:
|
||||
value, label = line, line
|
||||
data.append((value, label))
|
||||
|
@ -748,7 +748,11 @@ class CustomFieldChoiceSet(CloningMixin, ExportTemplatesMixin, ChangeLoggedModel
|
||||
if self.base_choices:
|
||||
self._choices.extend(CHOICE_SETS.get(self.base_choices))
|
||||
if self.extra_choices:
|
||||
self._choices.extend(self.extra_choices)
|
||||
extra_choices = []
|
||||
for choice in self.extra_choices:
|
||||
choice = (choice[0], choice[1].replace('\\:', ':'))
|
||||
extra_choices.append(choice)
|
||||
self._choices.extend(extra_choices)
|
||||
if self.order_alphabetically:
|
||||
self._choices = sorted(self._choices, key=lambda x: x[0])
|
||||
return self._choices
|
||||
|
Loading…
Reference in New Issue
Block a user