Ok, here's more :) Thanks for your help! db.define_table('auth_account', Field('subdomain','string',length=255,required=True), ... ) db.define_table('auth_many', #many to many relationship Field('account_id','reference auth_account',default=db.auth_account.id,required=True), Field('user_id','reference auth_user',default=auth.user_id,required=True) )
if auth.is_logged_in(): >> myset = db( >> (db.auth_account.id==db.auth_many.account_id) & >> (db.auth_many.user_id==auth.user_id) >> ) >> session.account = myset.select(db.auth_account.ALL).first()