I have created a new application named 'charges' utilizing MySQL database 
server.
At the model (produce_tables.py):
db.define_table('owner'
                ,Field('name','string'),
                ,Field('address','string')
                ,format='%(name)s'
                )

db.define_table('dog'
                ,Field('dogname','string',length=15,label='Onoma Skylou')
                ,Field('owner',db.owner, label='Idioktitis',readable=False)
                ,format='%(dogname)s'
                )
db.dog.id.readable = False

At the controller (test.py):
@auth.requires_login()
def testStarter():
    """This is to explore SQLFORM.smartgrid capabilities"""
    grid = 
SQLFORM.smartgrid(db.owner,fields=[db.owner.name],linked_tables=['dog'])
    return locals()

At the view (test/testStarter.html):
{{extend 'layout.html'}}
{{=grid}}

I use appadmin to populate the owners table with an owner and the dogs 
table with a dog for that owner.

Then, at http://127.0.0.1/charges/test/testStarter the smartgrid is shown 
for the master owner table and the 'dogs' link is shown ok. BUT: when you 
click on the 'dogs' link no dog record is returned (although it says it has 
found 1 record).

If I change the smartgrid definition so as to remove the 
fields=[db.owner.name] argument, that is:

def testStarter():
    """This is to explore SQLFORM.smartgrid capabilities"""
    grid = SQLFORM.smartgrid(db.owner,linked_tables=['dog'])
    return locals()

then everything works ok.

???

Thank you all in advance

Tom

P.S. OS: Windows XP Professional, SP3
       web2py version 2.4.6-stable+timestamp.2013.04.06.17.37.38 (Running 
on Rocket 1.2.6
       running web2py from source
       Python version: 2.7

-- 

--- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to