>
> db.define_table("articles",
>     Field('reference', db.sidemenu, requires=IS_IN_DB(db, 'sidemenu.id', 
> '%(title)s')), *# here i need smth like : db.sidemenu | db.topmenu ... and 
> is_in_db(db,'sidemenu.id' or 'topmenu.id')*
>     Field('image', 'upload'), 
>     Field("title",label=T('Title Ro'),requires=IS_NOT_EMPTY()),
>     Field("content" ,type='text',label=T('Content 
> Ro'),requires=IS_NOT_EMPTY()),
>     Field('added_on', 'date', default=request.now, 
> requires=IS_DATE(format=T('%d-%m-%Y')), writable=False),
>     Field('updated_on', 'datetime', default=request.now, 
> update=request.now, requires=IS_DATETIME(format=T('%d-%m-%Y %H:%M:%S')), 
>  writable=False),
>     Field('event', 'boolean', default=False),
>     Field('public', 'boolean', default=True))
>

The records in sidemenu and topmenu will have record ids in common, so you 
cannot uniquely identify menu items by id across those two tables. Rather 
than making it a reference field, you can just make it an integer field 
that stores the record id, and then add a separate field that indicates 
whether the id in the reference field belongs to the sidemenu or topmenu. 
This will require some extra logic to handle inserts and queries. There may 
be a better way.

Anthony

Reply via email to