Anthony,
I have lengthy tables so I am going to post where the fields that I need.
Like I said this works on grid but not on Database Administration tool.
db.define_table('supplier',
Field('suppliercode'),
Field('suppliername'),
format='%(suppliercode)s')
db.supplier.suppliercode.requires =
IS_NOT_IN_DB(db,db.supplier.suppliercode)
db.supplier.suppliername.requires =
IS_NOT_IN_DB(db,db.supplier.suppliername)
db.define_table('series',
Field('supplier','reference supplier'),
Field('supptile',represent=lambda id, r: '%s%s'%
(r.supplier.suppliercode,r.product.tilename)),
Field('seriesname'),
Field('seriesdescription'),
Field('description'))
db.define_table('product',
Field('series', 'reference series'),
Field('description'),
Field('conversiontype'),
Field('inactive','boolean'))
On Tuesday, July 9, 2013 3:55:04 PM UTC-7, Anthony wrote:
>
> Would help if you showed your data models. Presumably the db.product table
> includes a reference field that references this table. That allows you to
> do a recursive select in reverse (see the last part of this
> section<http://web2py.com/books/default/chapter/29/06#Recursive-selects>).
> When you select a record from this table (let's call the record "r"), then
> r.product is a LazySet object that refers to all the records in db.product
> that have a reference to this particular record. You can then use that as
> any DAL Set object. If you need to further filter the set, you can add a
> condition by doing r.product(some_query), and if you want to select the
> records, you can do r.product.select(). Assuming there are potentially
> multiple product records that reference a given record in this table, it's
> not clear how you would want to use those records to construct the
> "represent" output for the field.
>
> Anthony
>
> On Tuesday, July 9, 2013 6:32:33 PM UTC-4, greenpoise wrote:
>>
>> I am getting this error. My grid works fine but when I try to log into
>> the database administration tool, I get this error. Any clue?
>>
>> File
>> "/home/xxx/Applications/web2py/applications/APPLICACION/models/db_catalog.py"
>>
>> <http://127.0.0.1:8000/admin/default/edit/MOSAIC_POSx2/models/db_catalog.py>,
>> line 72, in <lambda>
>> Field('supptile',represent=lambda id, r: '%s%s'%
>> (r.supplier.suppliercode,r.product.tilename)),
>> AttributeError: 'LazySet' object has no attribute 'tilename'
>>
>>
>>
>>
--
---
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/groups/opt_out.