Thanks a lot Massimo, that's perfect. Il giorno lunedì 12 gennaio 2015 05:07:21 UTC+1, Massimo Di Pierro ha scritto: > > How about this? > > L1, L2 = db.l1_categories, db.l2_categories > categories=db(L2.l1_categories==L1.id).select(L2.ALL, orderby=L1.name > <http://db.l2_categories.l1_category.name/>) > > On Sunday, 11 January 2015 15:57:47 UTC-6, Gael Princivalle wrote: >> >> Hello all. >> >> We talk about a categories system for a vertical menu. >> >> Here is my model: >> db.define_table('l1_categories', >> Field('name'), >> format = '%(name)s') >> >> db.define_table('l2_categories', >> Field('l1_category', 'reference l1_categories'), >> Field('name'), >> format=lambda row: '%s - %s' % (row.l1_category.name, row.name)) >> >> My controller: >> def products(): >> categories=db().select(db.l2_categories.ALL, orderby= >> db.l2_categories.l1_category.name) >> return dict(categories=categories) >> >> I need to order categories by l1_category.name. >> Like that it's ordered by l1_category.id. >> Someone knows how I can order these categories by l1_category.name ? >> >> Thanks, regards. >> >>
-- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.

