mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-18 13:38:16 -06:00
13983 use re for split
This commit is contained in:
parent
a533275649
commit
5c0177049b
@ -1,3 +1,5 @@
|
|||||||
|
import re
|
||||||
|
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from django.contrib.postgres.forms import SimpleArrayField
|
from django.contrib.postgres.forms import SimpleArrayField
|
||||||
@ -93,7 +95,7 @@ class CustomFieldChoiceSetImportForm(CSVModelForm):
|
|||||||
data = []
|
data = []
|
||||||
for line in self.cleaned_data['extra_choices']:
|
for line in self.cleaned_data['extra_choices']:
|
||||||
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