From ecb4b3387df36ba535dd923c6f7263465a4411a9 Mon Sep 17 00:00:00 2001 From: Simon Coulton Date: Fri, 11 Mar 2016 14:40:04 +1100 Subject: [PATCH] Fixed bug for non-string values --- watson/form/fields.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/watson/form/fields.py b/watson/form/fields.py index 8931131..469fe43 100644 --- a/watson/form/fields.py +++ b/watson/form/fields.py @@ -293,9 +293,11 @@ def render(self, **kwargs): attributes.update(kwargs) if value: attributes['value'] = value - if isinstance(self.value, (list, tuple)) and value in self.value: - attributes['checked'] = 'checked' - elif self.value and value == self.value: + value = str(value) + if isinstance(self.value, (list, tuple)): + if value in (str(val) for val in self.value): + attributes['checked'] = 'checked' + elif self.value and value == str(self.value): attributes['checked'] = 'checked' flat_attributes = flatten_attributes(attributes) element = self.__render_input(