Hello,

I am just starting out in w2p. Could you please advise how to approach this 
kind of scenario?

I need a following db design:

db.define_table('person',
                Field('first_name'),
                Field('last_name'),
                format='%(last_name)s, %(first_name)s')

db.define_table('client',
                Field('person_id', 'reference person'),
                format=lambda r: '%s, %s' % (r.person.last_name, r.person.
first_name))

db.define_table('student',
                Field('person_id', 'reference person'),
                Field('client_id', 'reference client'),
                format=lambda r: '%s, %s' % (r.person.last_name, r.person.
first_name))

The student table has references to both client and person table. The 
client table references person as well.

I don't fully understand why I get AttributeError when trying to add the 
student field in Admin DB interface. Why the client record has no person 
attribute? If I change the format of the client table to say "lambda r: 
str(r)", I am able to see both person and client dropdown boxes properly 
and able to add the fields. How to show the person in the client reference?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.

Reply via email to