perf: 优化导入账号报错

pull/12395/head
ibuler 2023-12-21 11:56:10 +08:00 committed by 老广
parent 88b9a4d693
commit ca026040fe
1 changed files with 4 additions and 0 deletions

View File

@ -66,6 +66,10 @@ class LabeledChoiceField(ChoiceField):
def to_internal_value(self, data):
if isinstance(data, dict):
data = data.get("value")
if "(" in data and data.endswith(")"):
d = data.strip(")").split('(')[-1]
if d in self.choices:
data = d
return super(LabeledChoiceField, self).to_internal_value(data)