From 221150535030958c4b92d34b23e7900203c8fc70 Mon Sep 17 00:00:00 2001
From: "J.-S. Caux" <J.S.Caux@uva.nl>
Date: Tue, 20 Sep 2016 17:41:28 +0200
Subject: [PATCH] Debug invitation form

---
 scipost/forms.py | 6 ++++--
 scipost/views.py | 3 +++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/scipost/forms.py b/scipost/forms.py
index 6e86d1d46..172bedcc7 100644
--- a/scipost/forms.py
+++ b/scipost/forms.py
@@ -67,9 +67,11 @@ class RegistrationInvitationForm(forms.ModelForm):
             {'placeholder': 'NOTE: a personal phrase or two. The bulk of the text will be auto-generated.'})
         self.fields['cited_in_submission'] = forms.ModelChoiceField(
             queryset=Submission.objects.all().exclude(
-                status__in=SUBMISSION_STATUS_PUBLICLY_UNLISTED).order_by('-submission_date'))
+                status__in=SUBMISSION_STATUS_PUBLICLY_UNLISTED).order_by('-submission_date'),
+            required=False)
         self.fields['cited_in_publication'] = forms.ModelChoiceField(
-            queryset=Publication.objects.all().order_by('-publication_date'))
+            queryset=Publication.objects.all().order_by('-publication_date'),
+            required=False)
         self.helper = FormHelper()
         self.helper.layout = Layout(
             Div(
diff --git a/scipost/views.py b/scipost/views.py
index e56bf12b0..81425908c 100644
--- a/scipost/views.py
+++ b/scipost/views.py
@@ -465,6 +465,9 @@ def registration_invitations(request):
                 Utils.create_invitation()
                 Utils.send_registration_invitation_email()
                 return HttpResponseRedirect('registration_invitation_sent')
+        else:
+            errormessage = 'The form was not filled validly.'
+            
     else:
         reg_inv_form = RegistrationInvitationForm()
 
-- 
GitLab