Hello
i have an app with table A and B
Each record in A and B can have many upload files so i created table C and
D respectively just to collect upload files from A and B
This is my table C and D (they are equal)
db.define_table('C_files',
Field('f_emp_ref', db.A, notnull=True, writable=False,
readable=False),
Field('f_titulo', type='string', label=T('Categoria'),
notnull=False),
Field('f_doc', type='upload', autodelete=True,notnull=False,
label=T('Documentos'),
represent=lambda x, row:x and
A('%s'%(db.e_docs.f_doc.retrieve(x)[0]),
_href=URL('default','viewer.html',args=x),
_target="_blank",
_title=T("open file"),
_class='file-reference')
or ''),
)
db.define_table('D_files',
Field('f_emp_ref', db.B, notnull=True, writable=False,
readable=False),
Field('f_titulo', type='string', label=T('Categoria'),
notnull=False),
Field('f_doc', type='upload', autodelete=True,notnull=False,
label=T('Documentos'),
represent=lambda x, row:x and
A('%s'%(db.e_docs.f_doc.retrieve(x)[0]),
_href=URL('default','viewer.html',args=x),
_target="_blank",
_title=T("open file"),
_class='file-reference')
or ''),
)
After that i realized that this looks stupid and i would like to short it
as possible.
How can i have just table C to collect upload files from table A and B ?
Thank you
António
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.