From 92274805c910b9280155f1987075af20f0fc370b Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Wed, 19 May 2010 09:14:17 +0100 Subject: [PATCH] Add further validation to stop errors with users not adding a API key before applying. --- hr/forms.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hr/forms.py b/hr/forms.py index 4e4cbeb..e346d77 100644 --- a/hr/forms.py +++ b/hr/forms.py @@ -31,6 +31,10 @@ def CreateApplicationForm(user): corporation = forms.ModelChoiceField(queryset=corporations, required=True, empty_label=None) def clean(self): + + if not 'character' in self.cleaned_data or not self.cleaned_data['character']: + raise forms.ValidationError("Please select a character to apply with") + if len(Application.objects.filter(character=self.cleaned_data['character'], status__in=[APPLICATION_STATUS_NOTSUBMITTED, APPLICATION_STATUS_AWAITINGREVIEW, APPLICATION_STATUS_QUERY])): raise forms.ValidationError("This character already has a open application")