alfonsodg / demo-web2py

Apache License 2.0
0 stars 0 forks source link

new feature: polymodel on GAE #105

Closed alfonsodg closed 10 years ago

alfonsodg commented 10 years ago

From massimod...@gmail.com on September 04, 2010 15:29:11

supported on trunk needs testing

Original issue: http://code.google.com/p/web2py/issues/detail?id=106

alfonsodg commented 10 years ago

From massimod...@gmail.com on September 12, 2010 19:57:27

Example of usage:

db=DAL('gae') db.define_table('contact',Field('address'), polymodel=True) db.define_table('person',Field('first_name'), db.contact, polymodel=db.contact) db.define_table('company',Field('business_name'),db.contact,polymodel=db.contact)

if not db(db.contact.id>0).count(): db.person.insert(first_name="John", address='here') db.company.insert(business_name="John Inc", address='there')

contacts = db(db.contact.id>0).select()

Status: Fixed