fix: WMaterialCreateSerializer 所有字段设为必填
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
320822019a
commit
68191dc305
|
|
@ -211,6 +211,12 @@ class WMaterialCreateSerializer(CustomModelSerializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = WMaterial
|
model = WMaterial
|
||||||
fields = ['material', 'count', 'batch', 'mgroup']
|
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):
|
def validate(self, attrs):
|
||||||
attrs['belong_dept'] = attrs['mgroup'].belong_dept
|
attrs['belong_dept'] = attrs['mgroup'].belong_dept
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue