diff --git a/physionet-django/project/forms.py b/physionet-django/project/forms.py index 82283d0d9..229dfb1e9 100644 --- a/physionet-django/project/forms.py +++ b/physionet-django/project/forms.py @@ -1032,8 +1032,17 @@ def clean(self): raise forms.ValidationError( 'You are not invited.') - if cleaned_data['response'] and not cleaned_data.get('affiliation'): - raise forms.ValidationError('You must specify your affiliation.') + if cleaned_data['response']: + if self.user == self.instance.project.editor: + raise forms.ValidationError( + 'You must reassign this project to another editor ' + 'before accepting an authorship invitation.' + ) + + if not cleaned_data.get('affiliation'): + raise forms.ValidationError( + 'You must specify your affiliation.' + ) return cleaned_data