Commit e7a9b9b2 authored by Nicolas Delaby's avatar Nicolas Delaby

Improve render_view for DurationFields

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17428 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d61c3572
...@@ -59,9 +59,12 @@ class DurationWidget(FormulatorPatch.IntegerWidget): ...@@ -59,9 +59,12 @@ class DurationWidget(FormulatorPatch.IntegerWidget):
sub_value = '' sub_value = ''
else: else:
sub_value, value = divmod(value, convertion) sub_value, value = divmod(value, convertion)
sub_field_render_list.append(str(sub_value))
sub_field_render_list.append(self.render_sub_field_view(
field,sub_value))
# Render second # Render second
sub_field_render_list.append(str(value)) sub_field_render_list.append(self.render_sub_field_view(
field, value))
return ':'.join(sub_field_render_list) return ':'.join(sub_field_render_list)
def render(self, field, key, value, REQUEST): def render(self, field, key, value, REQUEST):
...@@ -81,6 +84,13 @@ class DurationWidget(FormulatorPatch.IntegerWidget): ...@@ -81,6 +84,13 @@ class DurationWidget(FormulatorPatch.IntegerWidget):
value, REQUEST, 'second')) value, REQUEST, 'second'))
return ':'.join(sub_field_render_list) return ':'.join(sub_field_render_list)
def render_sub_field_view(self, field, value):
"""
Render dynamically a subfield
"""
return FormulatorPatch.IntegerFieldWidgetInstance.render_view(field,
value)
def render_sub_field(self, field, key, value, REQUEST, keyword): def render_sub_field(self, field, key, value, REQUEST, keyword):
""" """
Render dynamically a subfield Render dynamically a subfield
......
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