diff --git a/ietf/secr/groups/forms.py b/ietf/secr/groups/forms.py index be53cf82b..a21d57243 100644 --- a/ietf/secr/groups/forms.py +++ b/ietf/secr/groups/forms.py @@ -74,6 +74,12 @@ class GroupModelForm(forms.ModelForm): if lsgc: self.fields['liaison_contacts'].initial = lsgc.contacts + def clean_acronym(self): + acronym = self.cleaned_data['acronym'] + if any(x.isupper() for x in acronym): + raise forms.ValidationError('Capital letters not allowed in group acronym') + return acronym + def clean_parent(self): parent = self.cleaned_data['parent'] type = self.cleaned_data['type'] diff --git a/ietf/secr/groups/tests.py b/ietf/secr/groups/tests.py index c49d95cd1..92184be6f 100644 --- a/ietf/secr/groups/tests.py +++ b/ietf/secr/groups/tests.py @@ -84,6 +84,22 @@ class GroupsTest(TestCase): response = self.client.post(url,post_data) self.assertEqual(response.status_code, 200) + def test_add_group_capital_acronym(self): + area = GroupFactory(type_id='area') + url = reverse('ietf.secr.groups.views.add') + post_data = {'acronym':'TEST', + 'name':'Test Group', + 'type':'wg', + 'status':'active', + 'parent':area.id, + 'awp-TOTAL_FORMS':'2', + 'awp-INITIAL_FORMS':'0', + 'submit':'Save'} + self.client.login(username="secretary", password="secretary+password") + response = self.client.post(url,post_data) + self.assertEqual(response.status_code, 200) + self.assertContains(response, 'Capital letters not allowed in group acronym') + # ------- Test View -------- # def test_view(self): MeetingFactory(type_id='ietf')