Commit 99963bac authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

support non-editable mode in FormBox.

parent ec0d621d
...@@ -88,15 +88,24 @@ class FormBoxWidget(Widget.Widget): ...@@ -88,15 +88,24 @@ class FormBoxWidget(Widget.Widget):
""" """
Render a form in a field Render a form in a field
""" """
return self._render(field, key, value, REQUEST, render_prefix=render_prefix)
def render_view(self, field, value, REQUEST, render_prefix=None):
"""
Render a view form in a field
"""
return self._render(field, None, value, REQUEST, render_prefix=render_prefix)
def _render(self, field, key, value, REQUEST, render_prefix=None):
result = ''
target_id = field.get_value('formbox_target_id')
if target_id not in (None, ''):
here = REQUEST['here'] here = REQUEST['here']
# If 'cell' is not defined, we define 'cell' just same as 'here', so # If 'cell' is not defined, we define 'cell' just same as 'here', so
# that we can use the same formbox for both ListBox and non-ListBox # that we can use the same formbox for both ListBox and non-ListBox
# using 'cell' parameter. # using 'cell' parameter.
if not REQUEST.has_key('cell'): if not REQUEST.has_key('cell'):
REQUEST.set('cell', here) REQUEST.set('cell', here)
result = ''
target_id = field.get_value('formbox_target_id')
if target_id not in (None, ''):
try: try:
form = getattr(here, target_id) form = getattr(here, target_id)
except AttributeError: except AttributeError:
......
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