fix form validation error if grantee_type not set
This commit is contained in:
parent
483d0c3bdf
commit
c04ec2430a
1 changed files with 3 additions and 0 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue