diff --git a/scipost_django/colleges/views.py b/scipost_django/colleges/views.py index 084b09801f69f813d9239bd01475d04a3b281b1a..8e48fdd425f40009690f9ada0b227a95d719e102 100644 --- a/scipost_django/colleges/views.py +++ b/scipost_django/colleges/views.py @@ -295,12 +295,19 @@ class FellowshipStartEmailView(PermissionsMixin, MailView): def form_valid(self, form): """Create an event associated to this outgoing email.""" - event = FellowshipNominationEvent( - nomination=self.object.nomination, - description="Fellowship start email sent", - by=self.request.user.contributor, - ) - event.save() + try: + event = FellowshipNominationEvent( + nomination=self.object.nomination, + description="Fellowship start email sent", + by=self.request.user.contributor, + ) + event.save() + except Fellowship.nomination.RelatedObjectDoesNotExist: + messages.warning( + self.request, + "No Nomination was found for this Fellowship, " + "so no event about sending a start email was created.", + ) return super().form_valid(form)