Commit 7d00899c by attiyaishaque Committed by Attiya Ishaque

EDUCATOR-626 Raise validation Error instead of 500 error.

parent 798b2063
......@@ -510,13 +510,14 @@ class PublisherUserCreationForm(forms.ModelForm):
fields = ('username', 'groups',)
def clean(self):
groups = self.cleaned_data.get('groups')
cleaned_data = super(PublisherUserCreationForm, self).clean()
groups = cleaned_data.get('groups')
if not groups:
raise forms.ValidationError(
{'groups': _('This field is required.')}
)
return self.cleaned_data
return cleaned_data
class CourseRunAdminForm(forms.ModelForm):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment