diff --git a/apps/wpm/serializers.py b/apps/wpm/serializers.py index e025c4c6..6a21170c 100644 --- a/apps/wpm/serializers.py +++ b/apps/wpm/serializers.py @@ -688,7 +688,7 @@ class MlogbInSerializer(CustomModelSerializer): 'wm_in': {'required': True, "allow_empty": False}} def validate(self, attrs): - if attrs["count_use"] < 0 or attrs["count_pn_jgqbl"] < 0 or attrs["count_break"] < 0: + if attrs["count_use"] < 0 or attrs["count_pn_jgqbl"] < 0 or attrs.get("count_break", 0) < 0: raise ParseError('存在负数!') mlog:Mlog = attrs['mlog'] is_fix = mlog.is_fix