From: Stephen Finucane Date: Fri, 23 Dec 2016 19:40:59 +0000 (+0000) Subject: forms: 'False' != False X-Git-Tag: v2.0.0-rc1~133 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=40496980e1883e872d50e615f7c1bf5ac0577f0c;p=thirdparty%2Fpatchwork.git forms: 'False' != False Forms cast boolean values to strings, and attempting to coerce using the 'bool' function does not correctly return them to true boolean values. Correct this by doing a string comparison instead. Signed-off-by: Stephen Finucane Fixes: 0abde97aa ("forms: Use TypedChoiceField") --- diff --git a/patchwork/forms.py b/patchwork/forms.py index 56f1d865..f42a224f 100644 --- a/patchwork/forms.py +++ b/patchwork/forms.py @@ -178,9 +178,10 @@ class MultiplePatchForm(forms.Form): action = 'update' state = OptionalModelChoiceField(queryset=State.objects.all()) archived = OptionalBooleanField( - choices=[('*', 'no change'), (True, 'Archived'), - (False, 'Unarchived')], - coerce=bool, empty_value='*') + choices=[('*', 'no change'), ('True', 'Archived'), + ('False', 'Unarchived')], + coerce=lambda x: x == 'True', + empty_value='*') def __init__(self, project, *args, **kwargs): super(MultiplePatchForm, self).__init__(*args, **kwargs)