From b01916001ee3e0e9b0081ba44f124b690a6ed027 Mon Sep 17 00:00:00 2001 From: wangruidong <940853815@qq.com> Date: Wed, 6 Nov 2024 18:57:01 +0800 Subject: [PATCH] fix: User import fails if MFA field is set to Disabled (0) --- apps/common/drf/parsers/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/common/drf/parsers/base.py b/apps/common/drf/parsers/base.py index 07126b541..2f553b50f 100644 --- a/apps/common/drf/parsers/base.py +++ b/apps/common/drf/parsers/base.py @@ -126,7 +126,7 @@ class BaseFileParser(BaseParser): value = self.id_name_to_obj(value) elif isinstance(field, LabeledChoiceField): value = self.id_name_to_obj(value) - if isinstance(value, dict) and value.get('pk'): + if isinstance(value, dict) and 'pk' in value: value = value.get('pk') elif isinstance(field, serializers.ListSerializer): value = [self.parse_value(field.child, v) for v in value]