I needed an advanced profile for a registered user with fields coming from
another table. Since I want to keep the same auth_user profile link, I
thought I'd used a virtual field in the auth_user table to display a link
to the other table.
class VFprofile(object):
def advanced_profile(self):
return self.auth_user.id
#append to my auth_user table
db.auth_user.virtualfields.append(VFprofile())
#db.auth_user.advanced_profile.represent=lambda v,r: A('Click
here',_href=URL('my_profile'))
I could check the values of the advanced_profile however the virtual field
wouldn't display when a user clicks his own profile. I commented out the
last line because it generates an error "KeyError:advanced_profile", but
without it the advanced_profile virtualfield is generated and accessible.
for i in db(db.auth_user.id>0).select():
print i.advanced_profile
....:
....:
1
2
I know that I can customize the auth_table, but I don't want to mess up
that table with optional information. Are virtual fields displayable?
Comments are welcome, or suggestions for the "proper" of way of doing this.
Nik