hi,

is anybody know how to create nested list? my intention is to create
category that have sub category (parent child list), should i use 2
table or just one table that refer to itself?
e.g.
db.define_table('category',
                Field('title'
                      )
                )

db.define_table('sub_category',
                Field('title',
                      label = T('Title')
                      ),
                Field('category_id',
                      db.category
                      )
                )
db.sub_category.category_id.requires = IS_IN_DB(db, db.category.id, '%
(title)s')

or

db.define_table('category',
                Field('title',
                      label = T('Title')
                      ),
                Field('parent_category_id',
                      'reference category'
                      ),
                )
db.category.parent_category_id.requires = IS_IN_DB(db, db.category.id,
'%(title)s')

and how about the controller and the views to display it?
please give an advice, pointer or suggestion.
thank you very much in advance

Reply via email to