Commit 55c8cf60 authored by Nicolas Delaby's avatar Nicolas Delaby

Implement render_odg_view for IntegerFields and CheckBox Fields


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42704 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 4be37d2c
......@@ -560,6 +560,17 @@ class CheckBoxWidget(Widget):
return etree.tostring(text_node)
return text_node
def render_odg_view(self, field, value, as_string, ooo_builder, REQUEST,
render_prefix, attr_dict, local_name):
"""Convert boolean value into integer (1/0) then into string.
"""
if value is None:
value = False
value = str(int(value))
return Widget.render_odg_view(self, field, value, as_string, ooo_builder,
REQUEST, render_prefix, attr_dict,
local_name)
CheckBoxWidgetInstance = CheckBoxWidget()
class TextAreaWidget(Widget):
......@@ -1745,6 +1756,17 @@ class IntegerWidget(TextWidget) :
return etree.tostring(text_node)
return text_node
def render_odg_view(self, field, value, as_string, ooo_builder, REQUEST,
render_prefix, attr_dict, local_name):
"""convert interger into string then use TextWidget renderer
"""
if isinstance(value, int):
# convert into string
value = str(value)
return TextWidget.render_odg_view(self, field, value, as_string,
ooo_builder, REQUEST, render_prefix,
attr_dict, local_name)
IntegerWidgetInstance = IntegerWidget()
class FloatWidget(TextWidget):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment