Skip to content

Commit

Permalink
Fixed bug for non-string values
Browse files Browse the repository at this point in the history
  • Loading branch information
simoncoulton committed Mar 11, 2016
1 parent 1570c7a commit ecb4b33
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions watson/form/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit ecb4b33

Please sign in to comment.