Another option is a list:reference field, which may work depending on how you want to be able to query friends.
Anthony On Wednesday, August 14, 2013 2:11:02 PM UTC-4, Marin Pranjić wrote: > > No, that's even worse :D > > Create new table called "friendship". > > Add two fields, "user_one" and "user_two" that both reference auth_user ID > field. > To get all friends, you have to make a database join with auth_user table. > > db.define_table('friendship', > Field('user_one', 'reference auth_user'), > Field('user_two', 'reference auth_user')) > > To get a list of friends of user with id USER_ID, you can do > > query=(db.friendship.user_one==USER_ID)&(db.auth_user.id==db.friendship. > user_two) > friends=db(query).select(db.auth_user.ALL) > > This is very basic implementation, just for demonstration. > > > Marin > > > Dana srijeda, 14. kolovoza 2013. 19:27:03 UTC+2, korisnik Hunt napisao je: >> >> Really? So I should just add like a 1000 "friend_id" fields to >> auth_user? I thought there would an easier way to go about this. >> >> Thanks though Marin! >> >> On Wednesday, August 14, 2013 2:07:08 AM UTC-4, Marin Pranjić wrote: >>> >>> Don't do that. It is wrong. >>> Create only one new table and put everything there >>> >>> Marin (mobile) >>> >>> On Aug 14, 2013 7:08 AM, "Hunt" <thedevil...@gmail.com> wrote: >>> >>> Did an absolutely atrocious job naming this question. A better title >>> would be: "How to auto-generate an additional table for each auth_user >>> table entry". >>> >>> >>> >>> On Tuesday, August 13, 2013 5:54:03 PM UTC-4, Hunt wrote: >>> > >>> > Hi all, >>> > >>> > I want to add a 'friends... >>> >>> >>> -- >>> >>> --- >>> You received this message because you are subscribed to the Google >>> Groups "web2py-users"... >>> >>> -- --- 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.