fix form validation error if grantee_type not set

This commit is contained in:
Élie Bouttier 2014-09-03 21:40:52 -07:00
parent 483d0c3bdf
commit c04ec2430a

View file

@ -42,6 +42,9 @@ class PermissionForm(forms.ModelForm):
grantees = Team.objects.filter(name=name)
if not grantees.exists():
raise ValidationError("Team '%s' does not exists." % name)
else:
# grantee_type is not in choice set, an error will be reported
return data
data['grantee_id'] = grantees.first().id