Allow FV to be submitted without newly uploaded pdf

This commit is contained in:
richard-dds
2018-10-22 17:34:57 -04:00
parent a84954799d
commit 1606bad016
2 changed files with 19 additions and 4 deletions

View File

@@ -29,6 +29,9 @@ class BaseFinancialForm(ValidatedForm):
"""
self.uii_ids.process_data(self.uii_ids.data)
def validate(self, **kwargs):
return super().validate()
def validate_draft(self):
"""
Another stupid workaround. Maybe there isn't a better way.
@@ -109,7 +112,18 @@ class ExtendedFinancialForm(BaseFinancialForm):
def validate(self, *args, **kwargs):
if self.funding_type.data == "OTHER":
self.funding_type_other.validators.append(InputRequired())
return super().validate(*args, **kwargs)
to_validator = None
if kwargs.get("has_attachment"):
to_validators = list(self.task_order.validators)
self.task_order.validators = []
valid = super().validate(*args, **kwargs)
if to_validator:
self.task_order.validators = to_validators
return valid
funding_type = SelectField(
description="What is the source of funding?",