paperwork: Handle missing certification definition/version in admin form
This commit is contained in:
parent
65669ab5da
commit
7b20c784d5
@ -24,6 +24,11 @@ class CertificationForm(forms.ModelForm):
|
|||||||
certification_version = cleaned_data.get("certification_version")
|
certification_version = cleaned_data.get("certification_version")
|
||||||
certification_definition = cleaned_data.get("certification_definition")
|
certification_definition = cleaned_data.get("certification_definition")
|
||||||
|
|
||||||
|
if certification_version is None:
|
||||||
|
raise ValidationError("Certification Version missing")
|
||||||
|
if certification_definition is None:
|
||||||
|
raise ValidationError("Certification Definition missing")
|
||||||
|
|
||||||
if certification_version.definition != certification_definition:
|
if certification_version.definition != certification_definition:
|
||||||
raise ValidationError(
|
raise ValidationError(
|
||||||
"Certification Version did not match Certification Definition!"
|
"Certification Version did not match Certification Definition!"
|
||||||
|
Loading…
Reference in New Issue
Block a user