From 28b94eceb2dcdc75c8ada223aa55f445ffed4af7 Mon Sep 17 00:00:00 2001 From: mdipierro Date: Fri, 21 Sep 2012 22:49:45 -0500 Subject: [PATCH] formstyle='inline' for forms with single field --- VERSION | 2 +- gluon/sqlhtml.py | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 2c33c26b..3886a680 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.0.9 (2012-09-21 22:29:49) stable +Version 2.0.9 (2012-09-21 22:49:39) stable diff --git a/gluon/sqlhtml.py b/gluon/sqlhtml.py index f2382e04..efe4a763 100644 --- a/gluon/sqlhtml.py +++ b/gluon/sqlhtml.py @@ -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'