From f1f11ba9e5511d5c0534929ed435baee994ff68b Mon Sep 17 00:00:00 2001 From: Jeremy Kerr Date: Sat, 23 Aug 2008 10:25:43 +0800 Subject: [PATCH] Use self.fields[field] rather than self.field when iterating form fields This way, we included the delegate field added in the MultiplePatchForm's constructor. Signed-off-by: Jeremy Kerr --- apps/patchwork/forms.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/patchwork/forms.py b/apps/patchwork/forms.py index 18c6a5e..7385ced 100644 --- a/apps/patchwork/forms.py +++ b/apps/patchwork/forms.py @@ -171,7 +171,8 @@ class MultiplePatchForm(PatchForm): def __init__(self, project, *args, **kwargs): super(MultiplePatchForm, self).__init__(project = project, *args, **kwargs) - self.fields['delegate'] = OptionalDelegateField(project = project) + self.fields['delegate'] = OptionalDelegateField(project = project, + required = False) def save(self, instance, commit = True): opts = instance.__class__._meta @@ -184,7 +185,7 @@ class MultiplePatchForm(PatchForm): if not f.name in data: continue - field = getattr(self, f.name, None) + field = self.fields.get(f.name, None) if not field: continue -- 2.39.2