You are exactly right --that was what I was looking for.  Thanks for
the quick reply.

In a similar vein, Is there something similar for an "Association
Table" , a many-to-many type relationship (via a multi-select box)?  I
realize that this is no longer editing just that table any longer --
it is following the foreign keys out.

For example (with below data model):
Is there a way to define the data model in such a way that when a new
"communications" row is added that it would also require recipients to
be selected? (Perhaps via a multi select box that has the available
people to select as recipients.  The results of that multi select box
would then also be added to the recipients table.)

db.define_table("people",
      SQLField("name", "string", notnull=True, default=None),
      SQLField("gdata_contact_id", "integer", notnull=True,
default=None))

db.define_table("communications",
      SQLField("id_people_author", db.people),
      SQLField("subject", "string", notnull=True, default=None),
      SQLField("message", "text", notnull=True, default=None))

db.define_table("recipients",
      SQLField("id_people", db.people),
      SQLField("id_communications", db.communications))

db.communications.id_people_author.requires=IS_IN_DB(db, 'people.id','%
(name)s')

db.recipients.id_people.requires=IS_IN_DB(db, 'people.id','%(name)s')
db.recipients.id_communications.requires=IS_IN_DB(db,
'communications.id','%(subject)s')

Perhaps I just need a better data model... which makes me ask, are
there example data models anywhere online?   I see some snippits on
your page http://mdp.cti.depaul.edu/examples/default/orm , however I
was looking for a few small complete data models for some simple
applications -- to get them right -- since the power of the framework
seems to lie in the ORM.

Jeremy


On Dec 20, 12:10 am, mdipierro <[email protected]> wrote:
> I think you are looking for
>
> db.groups.id_group_type.requires=IS_IN_DB(db,'group_type.id','%(type)
> s')
>
> this will make a dropbox with the group_type.id represented by their
> type(s).
>
> Massimo
>
> On Dec 20, 12:54 am, Jeremy Mikkelsen <[email protected]>
> wrote:
>
> > Great little framework you guys have going here.  I am new to python
> > (thanks GAE) and new to web2py. It actually reminds me of a php
> > framework that I liked and used called qcodo.  It takes a similar MVC
> > view toward things (despite being PHP) Web2py is really much simpler &
> > elegant, however one of the things about the qcodoORMgenerated CRUD
> > interface was that it incorporated the FK relationships.  In the admin
> > interface generated from theORMit would create a listbox for each
> > field that was a FK, and that list box would be populated by the
> > available values in the related table.  You then had to specify which
> > part of the data you wanted to see in the list box.
>
> > You can see what I am talking about in about four minutes...  pull up
> > the screencast located 
> > athttp://www.qcodo.com/demos/beta_2/demo_d_form_drafts/demo_d_form_draf...
> > and skip to 5:50 and watch until 10:00ish.
>
> > Here is my little test that I was working with, for the givenmodel
> > <code>
> > db.define_table("group_type",
> >       SQLField("type", "string", notnull=True, default=None))
>
> > db.define_table("groups",
> >       SQLField("title", "string", notnull=True, default=None),
> >       SQLField("desc", "string", notnull=True, default=None),
> >       SQLField("id_group_type", db.group_type))
> > </code>
>
> > I was envisioning that while "editing" [http://localhost:8000/XZY/
> > appadmin/insert/db/groups] the groups table from the admin interface
> > to see the list of available type id's as a drop down list along side
> > the other two text boxes. (Or even better the type string's which
> > would need to be based on a standard naming convention or
> > configuration.)
>
> > After all that... here is ny question: is something like that
> > available in web2py that I missed while watching your screencasts and
> > reading the online docs?  (I admit, I haven't jumped for the PDF or
> > book yet).
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to