I think there is said to say pro and con this convention. case1) db.define_table('person',Field('name')) db.define_table('dog',Field('name'),Field('owner_id',db.person)
db.god.owner_id makes sense because it stores an integer but db.dog.owner_id.name is odd because 'name' is not n attribute of an id. case2) db.define_table('person',Field('name')) db.define_table('dog',Field('name'),Field('owner',db.person) db.god.owner technically stores only an id db.dog.owne.name to me is better than db.dog.owner_id.name Massimo On Apr 24, 8:13 am, DenesL <denes1...@yahoo.ca> wrote: > Appending '_id' to references helps to keep names different so clashes > like the one above don't happen, while at the same time they make the > program more readable for the developer, specially at a later time. > > But conventions are a matter of personal preference so you can follow > whichever one you prefer. > Personally I like shorter names so I would have used something like > co_id and app_id, or even coid and appid, which are easier to type. > > From my experience: > - try to keep all names unique > - in particular never have fields names equal to table names > - don't be too cryptic with the name, you will regret it later > > web2py eases the creation of web apps but there still a lot of things > to remember and learn. > A checklist or tip list would be helpful. > What do others use? please share your tips and tricks. > > Denes. > > -- > Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en