mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-08-29 19:32:55 +00:00
perf: 优化 label choice
This commit is contained in:
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
Block a user