Commit 3e2315c8 authored by Alexandre Boeglin's avatar Alexandre Boeglin

Added FloatWidget formatting to render_view.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3248 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9f05869c
...@@ -757,9 +757,8 @@ class FloatWidget(TextWidget): ...@@ -757,9 +757,8 @@ class FloatWidget(TextWidget):
default=None, default=None,
required=0) required=0)
def render(self, field, key, value, REQUEST): def format_value(self, field, value):
"""Render Float input field """Formats the value as requested"""
"""
if value not in (None,''): if value not in (None,''):
input_style = field.get_value('input_style') input_style = field.get_value('input_style')
percent = 0 percent = 0
...@@ -790,9 +789,20 @@ class FloatWidget(TextWidget): ...@@ -790,9 +789,20 @@ class FloatWidget(TextWidget):
value += value_list[1] value += value_list[1]
if percent: if percent:
value += '%' value += '%'
return value
def render(self, field, key, value, REQUEST):
"""Render Float input field
"""
value = self.format_value(field, value)
return TextWidgetInstance.render(field, key, value, REQUEST) return TextWidgetInstance.render(field, key, value, REQUEST)
def render_view(self, field, value):
"""Render Float display field
"""
value = self.format_value(field, value)
return TextWidgetInstance.render_view(field, value)
FloatWidgetInstance = FloatWidget() FloatWidgetInstance = FloatWidget()
from Products.Formulator.StandardFields import FloatField from Products.Formulator.StandardFields import FloatField
FloatField.widget = FloatWidgetInstance FloatField.widget = FloatWidgetInstance
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