You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
488 B

from rest_framework import serializers
from .models import GoodsReception
class GoodsReceptionSerializer(serializers.ModelSerializer):
class Meta:
model = GoodsReception
fields = '__all__'
def validate(self, data):
if not data['quality_check'] or not data['shelf_life_valid']:
raise serializers.ValidationError("Товар не прошёл проверку качества или срок годности истёк.")
return data