You have thought of the correct solution ( I would call it project_steps ) .
On Monday, 9 September 2013 17:12:04 UTC+1, Andreas Wienes wrote: > > Hello, > > I've three models called project, project_type and steps. > > A project belongs to a certain project_type and depending on what kind of > project it is, includes different steps. For example "writing a book" is a > new project and belongs to the project_type "hobby project". > > "making a plan" and "get feedback" are steps for a "hobby project". So > the project "writing a book" should contain this steps. > > *My question:* > After creating a second project and saying it's also a "hobby project" the > new project is connected to the same steps like my first project. And if I > modify anything in a step, like mark "making a plan" as completed, it's > also completed for any other project. You can imagine that this is not what > I want to do. > > How can I create several steps for a new project, based on which > project_type it is? > > I thought about creating a new table "project-with-steps" and insert the > project_id and each project_steps for the project_type into it, but maybe > there is a smarter solution? > > This is my current database definition: > > db.define_table('project_type', > Field('title', notnull=True, unique=True), > Field('description', 'text', notnull=True), > format='%(title)s') > > db.define_table('project', > Field('name', notnull=True), > Field('description', 'text', notnull=True), > Field('project_type', db.project_type, notnull=True), > format='%(name)s') > > db.define_table('step', > Field('title', notnull=True, unique=True), > Field('description', 'text', notnull=True), > Field('project_id', db.project), > format='%(title)s') > > > db.define_table('project_type_with_steps', > Field('type_id', db.project_type), > Field('step_id', db.step)) > > > > > Thanks for your help! > Andreas > -- --- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.