I'm using CheckBoxFieldRenderer for rendering sqlalchemy boolean column
(can_read = Column(Boolean, default=0)). When I generate form and it's submited
it doesnt remember checkbox value (if it's checked). The problem is in
CheckBoxFieldRenderer in render method:
class CheckBoxFieldRenderer(FieldRenderer):
"""render a boolean value as checkbox field"""
def render(self, **kwargs):
return h.check_box(self.name, True, checked=_simple_eval(self.value or ''), **kwargs)
This always returns '' (if true is passed).
I fixed it by subclassing and capitalizing input (true to True).
class CheckBoxFieldFixedRenderer(CheckBoxFieldRenderer):
def render(self, **kwargs):
return h.check_box(
self.name, True,
checked=_simple_eval((self.value or '').capitalize()),
**kwargs
)
Original issue reported on code.google.com by mkr...@gmail.com on 20 Jan 2011 at 12:03
Original issue reported on code.google.com by
mkr...@gmail.com
on 20 Jan 2011 at 12:03