It sounded to me like the question was about foreign keys.
     SQLField("id_group_type", db.group_type))

has id_group_type being a reference to db.group_type.id (the default index
field created automatically in every table by web2py).

But I think your question was about referencing other columns in other
tables.  Is that correct?



On Sat, Dec 20, 2008 at 2: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 qcodo ORM generated CRUD
> > interface was that it incorporated the FK relationships.  In the admin
> > interface generated from the ORM it 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 given model
> > <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