Skip to content

Commit 3903094

Browse files
committed
Changed the WG edit form so that once an acronym has been set, the acronym
field is read-only; also changed the form validation to not permit changes to an existing acronym. - Legacy-Id: 6432
1 parent 422e5a4 commit 3903094

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

ietf/wginfo/edit.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,26 +50,30 @@ def __init__(self, *args, **kwargs):
5050

5151
self.confirm_msg = ""
5252
self.autoenable_confirm = False
53+
if self.wg:
54+
self.fields['acronym'].widget.attrs['readonly'] = True
5355

5456
def clean_acronym(self):
5557
self.confirm_msg = ""
5658
self.autoenable_confirm = False
5759

60+
# Changing the acronym of an already existing WG will cause 404s all
61+
# over the place, loose history, and generally muck up a lot of
62+
# things, so we don't permit it
63+
if self.wg:
64+
return self.wg.acronym # no change permitted
65+
5866
acronym = self.cleaned_data['acronym'].strip().lower()
5967

6068
# be careful with acronyms, requiring confirmation to take existing or override historic
61-
62-
if self.wg and acronym == self.wg.acronym:
63-
return acronym # no change, no check
64-
6569
if not re.match(r'^[a-z][a-z0-9]+$', acronym):
6670
raise forms.ValidationError("Acronym is invalid, must be at least two characters and only contain lowercase letters and numbers starting with a letter.")
6771

6872
existing = Group.objects.filter(acronym__iexact=acronym)
6973
if existing:
7074
existing = existing[0]
7175

72-
if not self.wg and existing and existing.type_id == "wg":
76+
if existing and existing.type_id == "wg":
7377
if self.confirmed:
7478
return acronym # take over confirmed
7579

0 commit comments

Comments
 (0)