Please is theare any chance to do this? without having to go for the 3
tables apporach?
To remind you all:
I have a multiselect like this one:
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'
With this line in index method of default.py I was able to filter the
content against the product selected in the profile:
db.audienceInstances.instances.requires=IS_IN_DB(db(db.instance.type==auth.user.product),
'instance.id',db.instance._format,multiple=True)
The problem is, If I change the product in the profile and update the
list of instances with the intstances of the newly selected product, I
lost the content in database for the other instances i selected for
the previous product. Is there any way to show the current instances,
but keep track of peviously selected?
THanks,
Nico