Is this what you want:
http://web2py.com/book/default/chapter/06#Self-Reference-and-Aliases
On Thursday, April 14, 2011 4:56:28 PM UTC-4, Oscar wrote:
> There is another way to do this?
>
> categories = db.Table(db, 'categories',
> Field('id', 'id'),
> Field('name', 'string', length=512,
> requires=(IS_SLUG())),
> Field('title', 'string', length=512,
> required=True),
> Field('description', 'text',
> default=""),
> Field('created_on', 'datetime',
> default=datetime.datetime.today()),
> Field('enabled', 'boolean',
> default=True),
> migrate=self.i2p.config.is_first_time)
>
> db.define_table('categories', categories, Field('parent_id',
> categories))
>
> Regards,
>
> Oscar.