From 70af478f661864500d8e3995f53d3b8bc856e650 Mon Sep 17 00:00:00 2001 From: ibuler Date: Thu, 15 Jun 2023 10:16:18 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E4=BF=AE=E6=94=B9=20?= =?UTF-8?q?rule=20vlaue?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/common/db/fields.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/common/db/fields.py b/apps/common/db/fields.py index cfa1e829b..4122aafb4 100644 --- a/apps/common/db/fields.py +++ b/apps/common/db/fields.py @@ -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)