Fixes #289, stops people with no characters creating a recommendation or application

This commit is contained in:
2012-08-08 17:34:50 +01:00
parent 33e1b05453
commit e168f66e00
2 changed files with 16 additions and 0 deletions

View File

@@ -22,6 +22,11 @@ class RecommendationForm(forms.Form):
super(RecommendationForm, self).__init__(*args, **kwargs)
self.fields['character'].queryset = EVEPlayerCharacter.objects.filter(eveaccount__user=user, eveaccount__api_status=API_STATUS_OK).distinct()
def clean_character(self):
if not 'character' in self.cleaned_data or self.cleaned_data['character'] is None:
raise forms.ValidationError("Please select a character.")
return self.cleaned_data['character']
def clean(self):
char = self.cleaned_data.get('character')
app = self.cleaned_data.get('application')