未填写项目更准确提示
This commit is contained in:
parent
6728ef10c4
commit
173d9f8987
|
@ -87,8 +87,9 @@ class TestRecordViewSet(ListModelMixin, UpdateModelMixin, RetrieveModelMixin, De
|
|||
raise exceptions.APIException('该记录已提交')
|
||||
# 校验是否有未填项目
|
||||
if obj.type != TestRecord.TEST_PROCESS_RE and obj.is_midtesting is False:
|
||||
if TestRecordItem.objects.filter(field_value__isnull=True, is_hidden=False, test_record=obj).exists():
|
||||
raise exceptions.APIException('存在未填写项目')
|
||||
items_not = TestRecordItem.objects.filter(field_value__isnull=True, is_hidden=False, test_record=obj)
|
||||
if items_not.exists():
|
||||
raise exceptions.APIException('存在未填写项目:'+ ','.join(list(items_not.values_list('form_field__name', flat=True))))
|
||||
with transaction.atomic():
|
||||
obj.is_submited=True
|
||||
obj.save()
|
||||
|
|
Loading…
Reference in New Issue