Hello,
I have a weird case where I need to make a self reference on a table but I
need to filter out the list of table entries present in my drop down.
# Model
dummy_sub_select_set = db(db.dummy_table.field1 == True) # Not working
dummy_sub_select_set = lambda: db(db.dummy_table.field1 == True) # Not
working either
db.define_table('dummy_table',
Field('represent_field', ...),
Field('field1', ...),
Field('field2', 'reference dummy_table',
requires=IS_IN_DB(dummy_sub_select_set,
'dummy_table.id', '%(represent_field)s'),
represent=lambda value, row: A(db.dummy_table
(id).represent_field,
_href=URL(...))
if id is not None else T(
'N/A'),
),
# This don't work either
db.define_table('dummy_table',
Field('represent_field', ...),
Field('field1', ...),
Field('field2', 'reference dummy_table',
requires=IS_IN_DB(db(db.dummy_table.field1 ==
True), 'dummy_table.id', '%(represent_field)s'),
represent=lambda value, row: A(db.dummy_table
(id).represent_field,
_href=URL(...))
if id is not None else T(
'N/A'),
),
Is there a way to filter up the content of a "not already" define table
with IS_IN_DB()?
Thanks
Richard
--
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.