Skip to content

Commit

Permalink
add affiliations validation error
Browse files Browse the repository at this point in the history
re: #440
  • Loading branch information
mdlincoln committed May 20, 2020
1 parent 2d43f73 commit 70fe1de
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions dh_abstracts/app/abstracts/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,16 @@ class WorkAuthorshipForm(forms.Form):
help_text="Use this optional menu to filter the affiliation list below. This value is only used for filtering and does not affect the final affiliation data that gets saved.",
)

def clean(self):
cleaned_data = super().clean()
affiliations = cleaned_data.get("affiliations")
institution = cleaned_data.get("institution")
if institution is not None and len(affiliations) < 1:
self.add_error(
"affiliations",
"You must enter a specific affiliation for each author. It is not sufficient to only select an institution - that field is used only to filter the available affiliations.",
)


class WorkForm(forms.ModelForm):
class Meta:
Expand Down

0 comments on commit 70fe1de

Please sign in to comment.