On Tue, Mar 19, 2013 at 8:06 PM, Alec Taylor <[email protected]> wrote:
> # Model [appname/models/far.py]
>
> db.define_table('far_members',
> Field('far_id', db.far, requires=IS_IN_DB(db, 'far.id')),
> Field('user_id', db.auth_user, default=auth.user_id, writable=False,
> requires=IS_IN_DB(db, 'auth_user.id'))
> )
>
> db.define_table('far',
> Field('cool_title'),
> Field('cool_content')
> )
>
> # Controller [appname/controllers/default.py]
>
> ''' I want to return the user profiles of all `far_members` '''
> def far():
> return db(db.auth_user.id == db(db.far_members.far_id ==
> request.args(0)).select(self.db.far_members.user_id)).select()
>
> # Call (id=1 is not blank)
>
> $ curl -X GET localhost/appname/far/1
>
> Server Error
See if it's what you want:
def far():
_set = db(
(db.auth_user.id == db.far_members.user_id)
& (request.args(0) == db.far_members.far_id))
rows = _set.select(db.auth_user.ALL)
_select = DIV(_set._select(db.auth_user.ALL))
return DIV(TABLE(rows), _select)
Ricardo
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.