I have currently this multiselect generated by list:references:

db.py:

db.define_table('instance',Field('app',db.application),Field('server',db.server),Field('type','string'),format=lambda
r: '%s %s' %(db.application[r.app].name,db.server[r.server].hostname))
...
db.define_table('audienceInstances', Field('instances','list:reference
instance'),Field('user',db.auth_user,writable=False, readable=False))

default.py:

monitoredInstances = db.audienceInstances(db.audienceInstances.user ==
auth.user.id)
    #Generates a form for the updation of the list of monitored instances
    instancesForm = SQLFORM(db.audienceInstances, monitoredInstances,
submit_button='Update', showid=False)
    if instancesForm.accepts(request.vars, session):
        response.flash = 'list updated'
    elif instancesForm.errors:
        response.flash = 'form has errors'

That shows a list select among all instances. But what if I'd like to
show a subset of that list, I mean I added a type field in instance
table, and like to get the instances of the type the user has selected
in its profile.

The only way I can think of is creating a separate audienceInstances
table for each type. Is there any othere way?

Thanks,
Nico

Reply via email to