summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2010-09-02 18:47:38 +0800
committerJeremy Kerr <jk@ozlabs.org>2010-09-02 19:50:34 +0800
commit73960c4331e70da50b65ac753558578ada03d9ce (patch)
tree7092308d51b50ec6168ba80a195ff670d644c848 /apps
parentf7535e706ecbf4c28f21e52978db12b3ec9e1f54 (diff)
downloadpatchwork-73960c4331e70da50b65ac753558578ada03d9ce.tar.bz2
patchwork-73960c4331e70da50b65ac753558578ada03d9ce.tar.xz
forms.MultiplePatchForm: remove no-change fields on clean()
We need to remove no-change fields, as newer versions of django are checking for proper types on validation. Fixes MultipleUpdateTest. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'apps')
-rw-r--r--apps/patchwork/forms.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/apps/patchwork/forms.py b/apps/patchwork/forms.py
index f78a105..2c137e3 100644
--- a/apps/patchwork/forms.py
+++ b/apps/patchwork/forms.py
@@ -186,6 +186,21 @@ class MultiplePatchForm(PatchForm):
self.fields['delegate'] = OptionalDelegateField(project = project,
required = False)
+ def _clean_fields(self):
+ super(MultiplePatchForm, self)._clean_fields()
+ # remove optional fields
+ opts = self.instance._meta
+ for f in opts.fields:
+ if not f.name in self.cleaned_data:
+ continue
+
+ field = self.fields.get(f.name, None)
+ if field is None:
+ continue
+
+ if field.is_no_change(self.cleaned_data[f.name]):
+ del self.cleaned_data[f.name]
+
def save(self, instance, commit = True):
opts = instance.__class__._meta
if self.errors: