Fix kaehmy form error
This commit is contained in:
+1
-1
@@ -43,7 +43,7 @@ class KaehmyForm_Form(forms.ModelForm):
|
||||
def clean_custom_role_name(self):
|
||||
"""Check that no other custom role with same name exists."""
|
||||
custom_name = self.cleaned_data.get('custom_role_name')
|
||||
if CustomKaehmyRole.objects.get(name=custom_name) is None:
|
||||
if not CustomKaehmyRole.objects.filter(name=custom_name).exists():
|
||||
return custom_name
|
||||
else:
|
||||
raise ValidationError(_('Custom role with the same name already exists.'))
|
||||
|
||||
Reference in New Issue
Block a user