mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 06:42:16 +00:00
Add further validation to stop errors with users not adding a API key before applying.
This commit is contained in:
@@ -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")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user