I apologize if this is more of a DB question than a web2py question, but I'm
having trouble with populating a drop down menu in the admin interface. I
have a table (called 'version')  with two keys ('name'  and 'version') and a
third column 'component_id'. This table records which versions of an
application use which software component: Example data:

   Name, Version, Component
   credit, 1.0.0      commons_all_1.2
   credit, 1.0.1,     commons_all_1.3
   credit, 1.0.0      commons_pools_6.3
   credit, 1.0.1,     commons_pools_6.5

Interpretaion: The credit application 1.0.0 uses commons_all_1.2 and
commons_pools_6.3
                    The credit application 1.0.1 uses commons_all_1.3 and
commons_pools_6.5

The problem occurs when I reference the version table from another table.
The drop down list contains:
      credit 1.0.0
      credit 1.0.0
      credit 1.0.1
      credit 1.0.1

I want the drop down menu to display the set {name, version}, instead of the
cartisian product of the two keys. Here's my db.py:

db.define_table('component',
    Field('component_name'),
    Field('component_version'),
    Field('label'))

db.define_table('version',
    Field('name'),
    Field('version'),
    Field('component_id', db.component))

db.define_table('report',
    Field('from_id', db.version),            # Drop down menu has cartisian
product of version.name X version.version
    Field('to_id', db.version))

db.version.component_id.requires = IS_IN_DB(db, db.component.id,
'%(component_name)s %(component_version)s')
db.report.from_id.requires = IS_IN_DB(db, db.version.id, '%(name)s
%(version)s')    # Again, I want a set, not a list.
db.report.to_id.requires = IS_IN_DB(db, db.version.id, '%(name)s
%(version)s')

Thanks,
C. helck

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.


Reply via email to