let's take a different POV: even if you work with classes, where should you 
store your "objects", and with what ?
web2py ships with DAL that is not an ORM like in other frameworks. The 
"classes" paradigm can be adopted too but it's usually an extra step that 
can be beneficial only in huge apps with lots of business logic. If in the 
end you're going to store your "objects" in a table using DAL, you're just 
back to square one ^_^

On Thursday, September 5, 2013 9:30:38 AM UTC+2, Andreas Wienes wrote:
>
> 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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to