Anyone have feedback? I have been banging my head against this all day... On Sunday, October 1, 2017 at 4:52:39 PM UTC-4, LoveWeb2py wrote: > > Hello, I'm trying to create a simple interface that allows users to select > multiple files and create a name for the bundle. I've followed the example > in the book but keep getting the same error... FOREIGN KEY constraint > failed. > > When I look in all_files, it has the keys available. > > I tried following this example: > http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#listtype-and-contains > > I am wondering if it has something to do with the filetype being an upload > field. > > I've even tried getting the reference object id by doing > > s = db(db.all_files.id>0).select() > file_ids = [x.id for x in s if int(x) in all_files] > > name = 'test_group_name' > file_ids = [1L, 2L, 3L] > > db.file_groups.insert(group_name=test_id, filename=file_ids) > > > > Function argument list > > (self=<pydal.adapters.sqlite.SQLite object>, table=<Table file_groups (id, > group_name, filename)>, fields=[(<pydal.objects.Field object>, [27, 28, 29, > 33, 34, 31, 30, 32, 35, 36]), (<pydal.objects.Field object>, 'filegroup1')]) > > > > > > db.define_table('all_files', > Field('filename','upload', unique=True), > Field('uploaded_by', db.auth_user), > format="%(filename)s") > > db.define_table('file_groups', > Field('group_name'), > Field('filename', 'list:reference all_files')) > > > > Sincerely appreciate any help... >
-- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.