On Mon, Mar 23, 2009 at 9:17 PM, Yarko Tymciurak <yark...@gmail.com> wrote:
> Hello Hans - > *snip* > You probably mean to have these be a table holding many-to-many > relationships. If so, these should be references (that is, they should > implement foreign keys), something like this: > > db.define_table('shapecolor', # note every web2py table by default > creates a unique field, 'id' > SQLField('shape_id', db.shape), > SQLField('color_id', db.color )) > > It may not be clear what these say: shape_id is a foreign key, and it references the table db.shape, that is it holds a reference to db.shape.id Another way to write references (useful when you have forward references, or a self-reference) is: SQLField('shape_id', 'reference shape') A self reference might look like: db.define_table('mine', SQLField('name'), SQLField('related_mine_id', 'reference mine')) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---