From 68191dc305538c0c0d05304e0086cc4696af32a8 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Fri, 27 Mar 2026 10:10:18 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20WMaterialCreateSerializer=20=E6=89=80?= =?UTF-8?q?=E6=9C=89=E5=AD=97=E6=AE=B5=E8=AE=BE=E4=B8=BA=E5=BF=85=E5=A1=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 --- apps/wpm/serializers.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/wpm/serializers.py b/apps/wpm/serializers.py index 1788594f..d3991f97 100644 --- a/apps/wpm/serializers.py +++ b/apps/wpm/serializers.py @@ -211,6 +211,12 @@ class WMaterialCreateSerializer(CustomModelSerializer): class Meta: model = WMaterial fields = ['material', 'count', 'batch', 'mgroup'] + extra_kwargs = { + 'material': {'required': True}, + 'count': {'required': True}, + 'batch': {'required': True}, + 'mgroup': {'required': True, 'allow_null': False}, + } def validate(self, attrs): attrs['belong_dept'] = attrs['mgroup'].belong_dept