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):
default=None,
required=0)
def render(self, field, key, value, REQUEST):
"""Render Float input field
"""
def format_value(self, field, value):
"""Formats the value as requested"""
if value not in (None,''):
input_style = field.get_value('input_style')
percent = 0
......@@ -790,9 +789,20 @@ class FloatWidget(TextWidget):
value += value_list[1]
if percent:
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)
def render_view(self, field, value):
"""Render Float display field
"""
value = self.format_value(field, value)
return TextWidgetInstance.render_view(field, value)
FloatWidgetInstance = FloatWidget()
from Products.Formulator.StandardFields import FloatField
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