db.define_table('entity', Field('name'), format='%(name)s')
auth_user_table = db.define_table(
    auth.settings.table_user_name,
    ... 
    Field('entity', 'list:reference db.entity',
           requires=IS_IN_DB(db, 'entity.id','%(name)s', multiple=True),
   ...
)

Later, I want to get a list of entities by name from the list: reference 
entry for the current user.

I would think I could do this:
user = db(db.auth_user.id == auth.user_id).select().first()
entities = db.auth_user.entity.represent(user.entity)
but I get a ticket:
  File "N:/web2py/applications/myapp/controllers/mycontroller.py", line 15, 
in myfunc
    return dict(etext=db.auth_user.entity.represent(user.entity))
TypeError: 'NoneType' object is not callable


I've tried a few different variations on the theme, but none working so 
far. Any help would be appreciated.

There are obvious slower ways to do this, but inelegant. I want the 
fastest, tightest solution.


Reply via email to