Hello,

I'm new to web2py and python and currently try to build a small application 
just for learning purposes. Now I struggle because I don't know if my 
solution is the right way doing it.

I got 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 
project and belongs to the project_type "hobby project".
 
"making a plan", "do it" and "get feedback" are steps for a "hobby 
project".  So the project "writing a book" should contain this steps.

Is it correct to create three tables, one for each model, and work with 
database reference or is this completly wrong and instead I should work 
with classes?

Sorry for the silly question, but I'm just a noob trying to code something. 
;-)

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))




All the best
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.

Reply via email to