Cheers Adi, spot on!

On Wednesday, 26 September 2012 03:19:26 UTC+2, Adi wrote:
>
> I think you need to flip it around, and use facilities instead of servers, 
> and then you will get the link to servers: 
>
> facilities = SQLFORM.smartgrid(db.facility, linked_tables={}, 
> user_signature=False, links_in_grid=True, editable=False, deletable=False)
> return dict(facilities=facilities)
>
>
> On Tue, Sep 25, 2012 at 5:06 AM, Dominic Cioccarelli <
> dominic.c...@gmail.com <javascript:>> wrote:
>
>> Hi all,
>>
>> I'm having some difficulties with smartgrid and linked tables. My model 
>> is as follows:
>>
>> db.define_table('facility',
>>     Field('facility_id','id'),
>>     Field('name'),
>>     Field('type'),
>>     migrate=False)
>>
>> db.define_table('server',
>>     Field('server_id','id'),
>>     Field('server_name'),
>>     Field('facility_id', db.facility),
>>     Field('active', 'boolean'),
>>     Field('modified_date', 'datetime'),
>>     migrate=False)
>>
>> Note that because it is an existing database, the primary key is not 
>> called "id" in the database but is defined as an ID type in the model. Not 
>> sure if this is important.
>>
>> The controller is as follows:
>>
>> def index():
>>     response.flash = "Welcome to the server view!"
>>     linked_tables = ['facility']
>>     servers = SQLFORM.smartgrid(db.server, linked_tables=['facility'], 
>> user_signature=False, links_in_grid=True, editable=False, deletable=False)
>>     return dict(servers=servers)
>>
>> When the table renders, it doesn't display hyper-links for the facility 
>> IDs as I would have expected.
>>
>> Am I missing something?
>>
>> Ciao,
>> Dominic.
>>
>>  -- 
>>  
>>  
>>  
>>
>
>

-- 



Reply via email to