perf: 优化修改 rule vlaue

pull/10725/head
ibuler 2023-06-15 10:16:18 +08:00
parent d7121296f2
commit 70af478f66
1 changed files with 2 additions and 0 deletions

View File

@ -500,6 +500,8 @@ class JSONManyToManyDescriptor:
value = value.values_list('id', flat=True)
elif isinstance(value, models.Model):
value = [value.id]
if isinstance(rule_value, (str, int)):
rule_value = [rule_value]
value = set(map(str, value))
rule_value = set(map(str, rule_value))
res &= bool(value & rule_value)