mirror of https://github.com/jumpserver/jumpserver
perf: 优化 label choice
parent
febf08629a
commit
bc5494bbb0
|
@ -66,10 +66,9 @@ 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
|
||||
|
||||
if isinstance(data, str) and "(" in data and data.endswith(")"):
|
||||
data = data.strip(")").split('(')[-1]
|
||||
return super(LabeledChoiceField, self).to_internal_value(data)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue