I have these tables and I'd like to get every file which has no article 
referred to it so I can delete them. What's the simplest way of achieving 
this?

db.define_table('articles',
                Field('created_on', 'datetime', default = 
datetime.today(),required 
= True, notnull = True, requires = [IS_NOT_EMPTY(), IS_DATETIME(format = 
T('%Y-%m-%d 
%H:%M:%S'))]),
                Field('article_teaser_hu', 'text', required = True, notnull 
= True, requires = IS_NOT_EMPTY()),
                Field('article_hu', 'text', required = True, notnull = 
True,requires 
= IS_NOT_EMPTY()),
                Field('article_teaser_en', 'text', required = True, notnull 
= True, requires = IS_NOT_EMPTY()),
                Field('article_en', 'text', required = True, notnull = 
True,requires 
= IS_NOT_EMPTY()))

db.define_table('files',
                Field('original_filename', 'string', required = True,notnull 
= True),
                Field('uploaded_file', 'upload', uploadfield = 
'uploaded_data', required = True, notnull = True, requires = IS_NOT_EMPTY
()),
                Field('uploaded_data', 'blob', notnull = True),
                Field('created_on', 'datetime', notnull = True))

db.define_table('articles_files',
                Field('articles', db.articles),
                Field('files', db.files))

Reply via email to