I am having an issue like what is described below. There was apparently a
solution posted in the ticket, but I can't seem to find old tickets now
that everything is over on github. Any advice?
Here is a single-table snippet similar to what I am trying to do. Rather
than deal with all the complexities of what I am really trying to do, this
is a similar test.
db.define_table('file_entry',
Field('file_name', 'string', required=True),
Field('isFile', 'boolean', required=True, default=True),
Field('isDir', 'boolean', required=True, default=False),
Field('children', 'list:reference file_entry', IS_IN_DB(db,
'file_entry.id', '%(file_name)s', multiple=True)),
Field('parent', 'reference file_entry',
requires=IS_EMPTY_OR(IS_IN_DB(db, 'file_entry.id',
'file_entry.file_name'))),
Field('file_size', 'integer'),
Field('sha256_hash', 'string'),
format='%(file_name)s'
)
Essentially I have a nested data structure I need to store in the DAL.
It's easy to store from the bottom up, but building the view may require
lots more SQL calls than if I can use a list:reference field. The app
deals with PDF AcroForms. An FDField may contain children. Children may
contain more children. Similar to a file system.
Thoughts?
Or can someone direct me to the original ticket?
On Monday, November 18, 2013 at 5:19:53 AM UTC-5, Hadi Sunyoto wrote:
>
> Just found out that this is an old bug:
> http://code.google.com/p/web2py/issues/detail?id=382&q=list#makechanges
> and the status is WontFix, but there is a solution inside the address above
>
>
>
>
> On Monday, November 18, 2013 2:54:14 PM UTC+7, Hadi Sunyoto wrote:
>>
>> the table i have:, common_type and grade is just another table with only
>> 1 field
>>
>> db.define_table('coil_type',
>> Field('common_type_id', 'reference common_type', label='Type'),
>> Field('grade_id', 'reference grade', label='Grade'),
>> Field('alternatives', 'list:reference coil_type'), <-- this is
>> displayed as string input with +- after that
>> Field('test1', 'list:reference common_type'), <-- this is displayed
>> as multi select (which is correct)
>> auth.signature)
>>
>> 1. alternatives field is displayed as string input with +- after that in
>> appadmin
>> 2. alternatives field does not check if the input is invalid. For
>> example: i insert 1 coil_type, and then i edit, and insert number 3 in
>> alternatives, it does not give error.
>>
>> my guess would be that somehow data in coil_type is not (yet) linked to
>> list:reference so no data is found, hence the string input is used instead
>> of multi select input
>>
>> Having list:reference should ease my development, so i would like to have
>> a solution for this kind of problem, thank you
>>
>> Hadi
>>
>
--
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.