Thanks, but that didn't work; I got this error: <type 'exceptions.AttributeError'> 'Row' object has no attribute 'id'
On Wed, Mar 20, 2013 at 7:27 AM, Richard Vézina <ml.richard.vez...@gmail.com> wrote: > If this select : > > db(db.far_members.far_id == > request.args(0)).select(self.db.far_members.user_id) > > return more then one row you need to use : > > belongs > > http://web2py.com/books/default/chapter/29/06#belongs > > So your query will look something like that : > > db(db.auth_user.id.belongs(db(db.far_members.far_id == > request.args(0)).select(self.db.far_members.user_id))).select() > > > Richard > > > > On Tue, Mar 19, 2013 at 4:06 PM, Alec Taylor <alec.tayl...@gmail.com> 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 >> >> -- >> >> --- >> 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 web2py+unsubscr...@googlegroups.com. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> > > -- > > --- > 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 web2py+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > -- --- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.