Prevent use of capital letters in group acronym. Fixes #2709. Commit ready for merge.

- Legacy-Id: 17491
This commit is contained in:
Ryan Cross 2020-03-21 21:01:34 +00:00
parent 5d3601334e
commit 3969d6c931
2 changed files with 22 additions and 0 deletions

View file

@ -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']

View file

@ -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')