Works fine , thanks
I saw it was a recurrent question, maybe you should add this in the
book
On 29 nov, 18:51, mdipierro wrote:
> my bad
>
> def index():
> rows = dict((r.id,r) for r in db(db.article).select())
> for id,row in rows.items(): row.children=[]
> for id,row in rows.ite
my bad
def index():
rows = dict((r.id,r) for r in db(db.article).select())
for id,row in rows.items(): row.children=[]
for id,row in rows.items():
if row.f_parent==1: root=row
else: rows[row.f_parent].children.append(row)
def tree(row):
return DIV(H1(row.tit
Hello,
here is what I did:
db.define_table('article',
Field('f_parent','reference article'),
Field('title'))
##
def index():
rows = dict((r.id,r) for r in db(db.article).select())
for id,row in rows.items(): row.children=[]
for id,row in rows.items():
if row.f_pare
That's it I'll try it
thanks a lot!
On 29 nov, 00:48, mdipierro wrote:
> I assume you are trying to build a hierarchial tree of articles and
> you want them all from the parent.
>
> I would do this something like this:
>
> db.define_table('article',Field('f_parent','reference
> article'),Field('
I assume you are trying to build a hierarchial tree of articles and
you want them all from the parent.
I would do this something like this:
db.define_table('article',Field('f_parent','reference
article'),Field('title'))
def index():
rows = dict((r.id,r) for r in db(db.article).select())
5 matches
Mail list logo