feat: 修改route serializer
This commit is contained in:
parent
15c4e195f3
commit
b2664ca81b
|
@ -134,7 +134,7 @@ class RoutePackSerializer(CustomModelSerializer):
|
|||
class Meta:
|
||||
model = RoutePack
|
||||
fields = '__all__'
|
||||
read_only_fields = EXCLUDE_FIELDS + ['state']
|
||||
read_only_fields = EXCLUDE_FIELDS + ['state', 'ticket']
|
||||
|
||||
def update(self, instance, validated_data):
|
||||
if validated_data['material'] != instance.material:
|
||||
|
@ -161,6 +161,8 @@ class RouteSerializer(CustomModelSerializer):
|
|||
read_only_fields = EXCLUDE_FIELDS
|
||||
|
||||
def validate(self, attrs):
|
||||
if 'routepack' in attrs:
|
||||
attrs['material'] = attrs['routepack'].material
|
||||
if 'mgroup' in attrs and attrs['mgroup']:
|
||||
attrs['process'] = attrs['mgroup'].process
|
||||
if attrs.get('process', None) is None:
|
||||
|
|
Loading…
Reference in New Issue