Changing the order wont do it either? Thanks
d On Sep 2, 11:28 am, mdipierro <[email protected]> wrote: > In your first example the project table is referning a table that does > not yet exist. You can do it but you must replace > > SQLField("id_project_location",db.project_location)) > > with > > SQLField("id_project_location","reference project_location")) > > On Sep 2, 9:43 am, greenpoise <[email protected]> wrote: > > > I have two samples here, one works, the other does not. They are > > pretty similar: > > > Example#1 > > > DOES NOT WORK: > > > db.define_table("project", > > SQLField("project_number", "text", notnull=True, default=None), > > SQLField("project_name", "text", notnull=True, default=None), > > SQLField("project_description", "text", notnull=True, > > default=None), > > SQLField("project_status", "integer", notnull=True, > > default=None), > > SQLField("contact", "integer", notnull=True, default=None) > > SQLField("id_project_location",db.project_location)) > > > """ > > Table definition > > """ > > db.define_table("project_location", > > SQLField("address_1", "text", notnull=True, default=None), > > SQLField("address_2", "text", notnull=True, default=None), > > SQLField("address_3", "text", notnull=True, default=None), > > SQLField("municipality", "integer", notnull=True, default=None), > > SQLField("country", "text", notnull=True, default=None), > > SQLField("zip_code", "text", notnull=True, default=None), > > SQLField("id_project", db.project)) > > > Example#2 > > DOES WORK: > > > db.define_table("project", > > SQLField("project_number", "text", notnull=True, default=None), > > SQLField("project_name", "text", notnull=True, default=None), > > SQLField("project_description", "text", notnull=True, > > default=None), > > SQLField("project_status", "integer", notnull=True, > > default=None), > > SQLField("contact", "integer", notnull=True, default=None)) > > > """ > > Table definition > > """ > > db.define_table("project_location", > > SQLField("address_1", "text", notnull=True, default=None), > > SQLField("address_2", "text", notnull=True, default=None), > > SQLField("address_3", "text", notnull=True, default=None), > > SQLField("municipality", "integer", notnull=True, default=None), > > SQLField("country", "text", notnull=True, default=None), > > SQLField("zip_code", "text", notnull=True, default=None), > > SQLField("id_project", db.project)) > > > If I do follow example#2, I would be creating a One-Many relationship, > > more locations per project which I do not want. Thanks > > > dan --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---

