Hello mate I have a small issue here.. I'm using the latest web2py
version.
Here is the situation... I'm trying to display an upload picture form
and in the form we can have three fields "The picture name field, the
upload file field, and a dropdown list for the album". I only want to
display the list of album name for the particular user NOT for all
user on the DB...
Here is my code below...
albumIdList = [
y.id for y in db(db.album.buacct_fk ==
session.auth.user.id).select(
db.album.id)]
db.photo.photoname.label='Photo'
db.photo.fileupload.label='Upload'
db.photo.albphotoref_fk.label='Album Name'
db.photo.albphotoref_fk.requires = IS_IN_SET(albumIdList)
db.photo.albphotoref_fk.requires = IS_IN_DB(db, "
album.id", "%
(albumname)s")
formPic = form_factory(db.photo, fields=
['photoname','fileupload','albphotoref_fk'])
if formPic.accepts( request.vars, session,
formname='formPic',keepvalues=True):
response.flash = 'Photo stored Fine'
return dict(formUploadPic = formPic)
# Please note that "albphotoref_fk" field is the foreign Key that link
the "Photo" table to the "Album" table
Using this code in the "Album Name" drop down I have the list of all
album name in the database instead of having only the album name list
of the current user...
I think is something I'm missing here... Can you please let me know if
you have any hints ?
Thanks in advance for your help.
Cheers,
Yannick P.