From 16ae849d688e159896948b4ee0c3be6882bfc96e Mon Sep 17 00:00:00 2001 From: Robert Sparks Date: Sat, 3 Nov 2018 03:55:53 +0000 Subject: [PATCH] Only do state-parent cross-validation on the group edit form when both fields are used on the form. (Many invocations of the form suppress all but one field.) Fixes #2597. Commit ready for merge. - Legacy-Id: 15681 --- ietf/group/forms.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ietf/group/forms.py b/ietf/group/forms.py index 8e6aab106..1cbc56ee8 100644 --- a/ietf/group/forms.py +++ b/ietf/group/forms.py @@ -4,6 +4,8 @@ from __future__ import unicode_literals, print_function # Stdlib imports import re +import debug # pyflakes:ignore + # Django imports from django import forms from django.utils.html import mark_safe @@ -200,7 +202,7 @@ class GroupForm(forms.Form): cleaned_data = super(GroupForm, self).clean() state = cleaned_data.get('state', None) parent = cleaned_data.get('parent', None) - if state and (state.slug in ['bof', ] and not parent): + if state and (state.slug in ['bof', ] and 'parent' in self.fields 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