SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 14319ee1 authored by Jorran de Wit's avatar Jorran de Wit
Browse files

Fix: clean methods in reg.invs not solid

parent cd722bc3
No related branches found
No related tags found
No related merge requests found
......@@ -19,7 +19,8 @@ from captcha.fields import ReCaptchaField
from ajax_select.fields import AutoCompleteSelectField
from haystack.forms import ModelSearchForm as HayStackSearchForm
from .constants import SCIPOST_DISCIPLINES, TITLE_CHOICES, SCIPOST_FROM_ADDRESSES
from .constants import SCIPOST_DISCIPLINES, TITLE_CHOICES, SCIPOST_FROM_ADDRESSES,\
INVITATION_CITED_SUBMISSION, INVITATION_CITED_PUBLICATION
from .decorators import has_contributor
from .models import Contributor, DraftInvitation, RegistrationInvitation,\
UnavailabilityPeriod, PrecookedEmail
......@@ -219,6 +220,16 @@ class RegistrationInvitationForm(forms.ModelForm):
queryset=Publication.objects.all().order_by('-publication_date'),
required=False)
def clean(self):
data = self.cleaned_data
if data.get('invitation_type') == INVITATION_CITED_SUBMISSION:
if not data.get('cited_in_submission'):
self.add_error('cited_in_submission', 'Please state the Submission cited.')
if data.get('invitation_type') == INVITATION_CITED_PUBLICATION:
if not data.get('cited_in_publication'):
self.add_error('cited_in_publication', 'Please state the Publication cited.')
return data
def clean_email(self):
email = self.cleaned_data['email']
if RegistrationInvitation.objects.filter(email=email).exists():
......
......@@ -49,7 +49,7 @@ $(document).ready(function(){
{% csrf_token %}
{{draft_inv_form.media}}
{{draft_inv_form|bootstrap}}
<input type="submit" class="btn btn-secondary"/>
<input type="submit" class="btn btn-primary" value="Submit"/>
</form>
</div>
</div>
......
......@@ -56,7 +56,7 @@ $(document).ready(function(){
{% csrf_token %}
{{reg_inv_form.media}}
{{reg_inv_form|bootstrap}}
<input type="submit" class="btn btn-secondary">
<input type="submit" class="btn btn-primary" value="Submit">
</form>
</div>
</div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment