Merged in [17491] from rcross@amsl.com:
Prevent use of capital letters in group acronym. Fixes #2709.
- Legacy-Id: 17513
Note: SVN reference [17491] has been migrated to Git commit 3969d6c931
This commit is contained in:
commit
79c3182da8
|
@ -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']
|
||||
|
|
|
@ -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')
|
||||
|
|
Loading…
Reference in a new issue