Hi Dan,
for now we do not support GAE ListProperty becase it would make the
code not portable on relational databases.
This is what you can do:
db.define_table('user',
SQLField('name'),
SQLField('email'),
SQLField('phone'),
SQLField('pets'))
db.define_table('pet',
SQLField('name'),
SQLField('animaltype'),
SQLField('trainings')
db.define_table('training',
SQLField('name'),
SQLField('teacher'),
SQLField('start_date','date'),
SQLField('end_date','date'),
SQLField('performance_scores'))
db.user.pets.requires=IS_IN_DB(db,'pet.id','%(id)s %(name)
s',multiple=True)
db.pet.trainings.requires=IS_IN_DB(db,'training.id','%(id)s %(name)
s',multiple=True)
then checkout admin.
I am not saying this is the best way. It depends on a lot of things.
This is the most compact way.
Massimo
On May 23, 2:33 pm, Dan <[email protected]> wrote:
> Hello-
> I am just starting out with both GAE and web2py. After reading through
> the GAE docs and thinking about my data, I designed a data model that
> is a hierarchy of a few levels using ReferenceProperty attributes to
> create the relationships between levels. Here is a simplified example
> of what I'm looking to put together:
>
> kind: user
> attributes: name, email, phone, pets (ReferenceProperty that is a list
> of entities)
>
> kind: pet
> attributes: name, animaltype, trainings (ReferenceProperty that is a
> list of entities)
>
> kind: training
> attributes: name, teacher, start_date, end_date, performance_scores
> (list of numeric scores)
>
> In this example, the user-to-pet relationship can be many-to-many, and
> the pet-to-training relationship is one-to-many.
>
> Now I'd like to start building this into an application with web2py.
> Is this possible? Any suggestions for documentation to read and
> examples to review would be very helpful. Thanks
> Dan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" 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
-~----------~----~----~----~------~----~------~--~---