Commit ba841b12 authored by Aurel's avatar Aurel

add render dict to search float field based on user format

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14751 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 29a8da6f
...@@ -1125,6 +1125,32 @@ class FloatWidget(TextWidget): ...@@ -1125,6 +1125,32 @@ class FloatWidget(TextWidget):
"""Render the field as PDF.""" """Render the field as PDF."""
return self.format_value(field, value) return self.format_value(field, value)
def render_dict(self, field, value):
"""
This is yet another field rendering. It is designed to allow code to
understand field's value data by providing its type and format when
applicable.
It returns a dict with 3 keys:
type : Text representation of value's type.
format: Type-dependant-formated formating information.
This only describes the field format settings, not the actual
format of provided value.
query : Passthrough of given value.
"""
input_style = field.get_value('input_style')
precision = field.get_value('precision')
if precision != 0:
for x in xrange(1, precision):
input_style += '5'
else:
input_style = input_style.split('.')[0]
return {'query': value,
'format': input_style,
'type': 'date'}
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