[web2py] Re: use crud to display some fields of a table

2010-08-16 Thread dlin
It works now. Thanks. I use the following code to display 'phmap' table. cols = [ 'phmap.' + c for c in db.phmap.fields()[1:]] # remove the 'id' field and form phmap.F1, phmap.F2,... list hdrs = dict([(str(c),c.label) for c in db.phmap]) wlist =SQLTABLE(words, headers = hdrs, c

[web2py] Re: use crud to display some fields of a table

2010-08-13 Thread mdipierro
./web2py -S myapp -M -N >>> words= db(db.phmap.id>0).select(limitby=(0,5),orderby='') -M = import models -N = do not run cron On Aug 13, 3:52 am, dlin wrote: > How can I use shell to try it before modify my web site? > > ./web2py -S myapp  will show the >>> prompt of ipython. > But, when I typ

[web2py] Re: use crud to display some fields of a table

2010-08-13 Thread dlin
How can I use shell to try it before modify my web site? ./web2py -S myapp will show the >>> prompt of ipython. But, when I type words= db(db.phmap.id>0).select(limitby=(0,5),order='') it will failed, I guess I must import something. On Aug 13, 4:11 pm, mdipierro wrote: >  headers=dict((s

[web2py] Re: use crud to display some fields of a table

2010-08-13 Thread mdipierro
headers=dict((str(c),c.label) for c in db.phmap) On Aug 13, 3:05 am, dlin wrote: > tks,  Massimo,  there is a typo "order" should be "orderby" in  your > sample. > > Could I  just define the columns, and let headers automatic get from > predefined labels? > Because, in fact, I have more fields i

[web2py] Re: use crud to display some fields of a table

2010-08-13 Thread dlin
tks, Massimo, there is a typo "order" should be "orderby" in your sample. Could I just define the columns, and let headers automatic get from predefined labels? Because, in fact, I have more fields instead of two. On Aug 13, 3:23 pm, mdipierro wrote: > words= db(db.phmap.id>0).select(limitb

[web2py] Re: use crud to display some fields of a table

2010-08-13 Thread mdipierro
words= db(db.phmap.id>0).select(limitby=(0,5),order='') table =SQLTABLE(words, headers={'phmap.F1':db.phmap.F1.label,phmap.F2:db.phmap.F2.label'}, columns=['phmap.F1',phmap.F2'], truncate=32) On Aug 13, 2:02 am, dlin wrote: > I've a table with fields > Field('F1', label='name') > Field