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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to