From b18f39d95daccb963f5bbfe07a7973a89c9fac2c Mon Sep 17 00:00:00 2001 From: caoqianming Date: Mon, 8 Jul 2024 08:25:45 +0800 Subject: [PATCH] fix: routepack serializer validate bug --- apps/mtm/serializers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/mtm/serializers.py b/apps/mtm/serializers.py index 3807d4f2..b84114c8 100644 --- a/apps/mtm/serializers.py +++ b/apps/mtm/serializers.py @@ -164,7 +164,7 @@ class RouteSerializer(CustomModelSerializer): read_only_fields = EXCLUDE_FIELDS def validate(self, attrs): - if 'routepack' in attrs: + if attrs.get('routepack', None): attrs['material'] = attrs['routepack'].material if 'mgroup' in attrs and attrs['mgroup']: attrs['process'] = attrs['mgroup'].process