Can you show your new code? So far, all we see is r.product.tilename, which 
won't work because r.product is a LazySet object -- you have to do 
r.product.select().first().tilename, or something along those lines (though 
that will just give you the tilename of the first product that references 
the record). Also, in the models you have shown, there is no tilename field 
in the db.product table.

Anthony

On Tuesday, July 9, 2013 11:34:27 PM UTC-4, greenpoise wrote:
>
> I re-opened this as I keep getting the same error. 
>
>
>
>
> On Tuesday, July 9, 2013 4:12:49 PM UTC-7, greenpoise wrote:
>>
>> I think I got it by reading the recursive select section. THanks!!!
>>
>>
>>
>>
>> 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.


Reply via email to