correction to generate options also for fields generated with requires=IS_IN_SET or any field with options attribute

This commit is contained in:
Carlos Costa
2018-06-12 19:55:25 -03:00
parent 8a741023d8
commit 9076053f7e
+7 -6
View File
@@ -2027,12 +2027,6 @@ class SQLFORM(FORM):
value_input = widget_.widget(field, field.default, _id=_id,
_class=widget_._class + ' form-control',
**iso_format)
elif hasattr(field.requires, 'options'):
value_input = SELECT(
*[OPTION(v, _value=k)
for k, v in field.requires.options()],
_class='form-control',
**dict(_id=_id))
elif (field_type.startswith('integer') or
field_type.startswith('reference ') or
field_type.startswith('list:integer') or
@@ -2046,6 +2040,13 @@ class SQLFORM(FORM):
_type='text', _id=_id,
_class="%s %s" % ((field_type or ''), 'form-control'))
if hasattr(field.requires, 'options'):
value_input = SELECT(
*[OPTION(v, _value=k)
for k, v in field.requires.options()],
_class='form-control',
**dict(_id=_id))
new_button = INPUT(
_type="button", _value=T('New Search'), _class="btn btn-default", _title=T('Start building a new search'),
_onclick="%s_build_query('new','%s')" % (prefix, field))