db.define_table('child', Field('parent',db.parent, requires=IS_NULL_OR(IS_IN_DB(db,'parent.id','%(title)s'))), Field('name','upload',length=50, autodelete=True, uploadfolder=os.path.join(request.folder,'static/data/child'), uploadseparate=True, ) ) db.define_table('parent', Field('user_id',db.auth_user, requires=IS_NULL_OR(IS_IN_DB(db,'auth_user.id'))), Field('categ',db.categ,label=T('Category'),default=12, requires=IS_IN_DB(db,'categ.id','%(name)s',zero=None)), Field('blah1','string',length=50,label=T('Blah')), Field('blah2','string',length=50,label=T('Blah')), Field('blah3','string',length=50,label=T('Blah')), etc. ) db.define_table('queue', Field('user_id',db.auth_user, requires=IS_NULL_OR(IS_IN_DB(db,'auth_user.id'))), Field('parent',db.parent,requires=IS_IN_DB(db,'parent.id')), Field('start','datetime'), Field('end','datetime'), Field('child',db.child,requires=IS_IN_DB(db,'child.id')), )
When I delete the parent, it's child is deleted, which is what I expect. When I delete the queue entry, the child is deleted, which is not desired. On Sep 19, 1:24 am, mdipierro <mdipie...@cs.depaul.edu> wrote: > Can you show us the table in question and the queue table? > > On Sep 18, 10:59 pm, weheh <richard_gor...@verizon.net> wrote: > > > I have a table with an upload field declared with autodelete=True. The > > upload file is not really uploaded, it's created on the fly. The table > > id is referenced by a queue, which is polled to determine whether or > > not the upload file needs to be created. Once created, the queue entry > > is deleted. This is where the problem is -- deleting the queue entry > > also deletes the uploaded file. I only want the uploaded file deleted > > when it's parent record is deleted, not when the queue record is > > deleted. I've tried a db.mytable.fieldname.autodelete=False just > > before deleting the queue entry, but this doesn't work. What should I > > be doing? > >