fix: 检定记录校验bug
This commit is contained in:
parent
c9d8a1e22f
commit
6a369883d6
|
@ -22,8 +22,8 @@ class EcheckRecordSerializer(CustomModelSerializer):
|
|||
read_only_fields = EXCLUDE_FIELDS
|
||||
|
||||
def validate(self, attrs):
|
||||
attrs = super().validate(attrs)
|
||||
check_date = attrs['check_date']
|
||||
if EcheckRecord.objects.filter(check_date__gte=check_date, equipment=attrs['equipment']).exists():
|
||||
raise ValidationError('检定日期小于历史记录')
|
||||
return attrs
|
||||
|
||||
|
|
Loading…
Reference in New Issue