fix: 检定记录校验bug

This commit is contained in:
caoqianming 2023-09-15 10:12:12 +08:00
parent c9d8a1e22f
commit 6a369883d6
1 changed files with 1 additions and 1 deletions

View File

@ -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