grid(Set(..)) as well as grid(Query(..))

This commit is contained in:
mdipierro
2016-02-03 22:11:38 -06:00
parent 7aff79ca57
commit 35216db750
+6 -1
View File
@@ -27,7 +27,7 @@ from gluon.html import FORM, INPUT, LABEL, OPTION, SELECT, COL, COLGROUP
from gluon.html import TABLE, THEAD, TBODY, TR, TD, TH, STYLE, SCRIPT from gluon.html import TABLE, THEAD, TBODY, TR, TD, TH, STYLE, SCRIPT
from gluon.html import URL, FIELDSET, P, DEFAULT_PASSWORD_DISPLAY from gluon.html import URL, FIELDSET, P, DEFAULT_PASSWORD_DISPLAY
from pydal.base import DEFAULT from pydal.base import DEFAULT
from pydal.objects import Table, Row, Expression, Field from pydal.objects import Table, Row, Expression, Field, Set
from pydal.adapters.base import CALLABLETYPES from pydal.adapters.base import CALLABLETYPES
from pydal.helpers.methods import smart_query, bar_encode, _repr_ref from pydal.helpers.methods import smart_query, bar_encode, _repr_ref
from pydal.helpers.classes import Reference, SQLCustomType from pydal.helpers.classes import Reference, SQLCustomType
@@ -2012,6 +2012,8 @@ class SQLFORM(FORM):
use_cursor=False): use_cursor=False):
formstyle = formstyle or current.response.formstyle formstyle = formstyle or current.response.formstyle
if isinstance(query, Set):
query = query.query
# jQuery UI ThemeRoller classes (empty if ui is disabled) # jQuery UI ThemeRoller classes (empty if ui is disabled)
if ui == 'jquery-ui': if ui == 'jquery-ui':
@@ -2178,12 +2180,15 @@ class SQLFORM(FORM):
dbset = db(query, ignore_common_filters=ignore_common_filters) dbset = db(query, ignore_common_filters=ignore_common_filters)
tablenames = db._adapter.tables(dbset.query) tablenames = db._adapter.tables(dbset.query)
print dbset.query
print tablenames
if left is not None: if left is not None:
if not isinstance(left, (list, tuple)): if not isinstance(left, (list, tuple)):
left = [left] left = [left]
for join in left: for join in left:
tablenames += db._adapter.tables(join) tablenames += db._adapter.tables(join)
tables = [db[tablename] for tablename in tablenames] tables = [db[tablename] for tablename in tablenames]
print tables
if fields: if fields:
# add missing tablename to virtual fields # add missing tablename to virtual fields
for table in tables: for table in tables: