mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-18 05:28:16 -06:00
14467 use regex for colon detection
This commit is contained in:
parent
df82f782be
commit
855c32a635
@ -1,4 +1,5 @@
|
|||||||
import json
|
import json
|
||||||
|
import re
|
||||||
|
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
@ -107,7 +108,7 @@ class CustomFieldChoiceSetForm(BootstrapMixin, forms.ModelForm):
|
|||||||
data = []
|
data = []
|
||||||
for line in self.cleaned_data['extra_choices'].splitlines():
|
for line in self.cleaned_data['extra_choices'].splitlines():
|
||||||
try:
|
try:
|
||||||
value, label = line.split(':', maxsplit=1)
|
value, label = re.split(r'(?<!\\):', line, maxsplit=1)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
value, label = line, line
|
value, label = line, line
|
||||||
data.append((value, label))
|
data.append((value, label))
|
||||||
|
Loading…
Reference in New Issue
Block a user