From d251692b963d5f079856702f42a9d07c25a76531 Mon Sep 17 00:00:00 2001 From: Henrik Levkowetz Date: Wed, 15 Jun 2016 19:46:47 +0000 Subject: [PATCH] Added a clean() method to the Group creation form which requires a BoF to have a parent group. Fixes issue #1970. - Legacy-Id: 11387 --- ietf/group/views_edit.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ietf/group/views_edit.py b/ietf/group/views_edit.py index 91ba6cbbc..a3679ebc3 100644 --- a/ietf/group/views_edit.py +++ b/ietf/group/views_edit.py @@ -133,6 +133,13 @@ class GroupForm(forms.Form): MAX_GROUP_DELEGATES, len(self.cleaned_data["delegates"]) - MAX_GROUP_DELEGATES)) return self.cleaned_data["delegates"] + def clean(self): + cleaned_data = super(GroupForm, self).clean() + state = cleaned_data.get('state', None) + parent = cleaned_data.get('parent', None) + if state.slug in ['bof', ] and not parent: + raise forms.ValidationError("You requested the creation of a BoF, but specified no parent area. A parent is required when creating a bof.") + return cleaned_data def format_urls(urls, fs="\n"): res = []