formstyle='inline' for forms with single field

This commit is contained in:
mdipierro
2012-09-21 22:49:45 -05:00
parent e4c63769f2
commit 28b94eceb2
2 changed files with 12 additions and 1 deletions

View File

@@ -1 +1 @@
Version 2.0.9 (2012-09-21 22:29:49) stable
Version 2.0.9 (2012-09-21 22:49:39) stable

View File

@@ -770,6 +770,16 @@ def formstyle_divs(form, fields):
table.append(DIV(_label, _controls, _help, _id=id))
return table
def formstyle_inline(form, fields):
''' divs only '''
if len(fields)!=2:
raise RuntimeError, "Not possible"
id, label, controls, help = fields[0]
submit_button = fields[1][2]
return CAT(DIV(controls,_style='display:inline'),
submit_button)
def formstyle_ul(form, fields):
''' unordered list '''
table = UL()
@@ -895,6 +905,7 @@ class SQLFORM(FORM):
divs = formstyle_divs,
ul = formstyle_ul,
bootstrap = formstyle_bootstrap,
inline = formstyle_inline,
))
FIELDNAME_REQUEST_DELETE = 'delete_this_record'