#Created a new application 'charges' which utilizes MySQL Server with the
following:
#At the model file (produce_files.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 file (test.py):
from gluon import *
@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 file (test/appStarter.py):
{{extend 'layout.html'}}
{{=grid}}
I use the appadmin of the application to populate the 'owner' table with an
owner, as well as the 'dog' table with a dog for that owner.
Now, when I visit http://127.0.0.1/charges/test/testStarter.html I get to
see the 'owner' table in the grid, as well as the 'dogs' link. Everything
seems ok, BUT: when I click on the 'dogs' link for the sole owner I have
already inserted, there is no dog there. The header of the fields for the
dog grid is not shown, and the header for the 'owner' table is shown
instead. Nevertheless, the application reports correctly that 1 dog record
has been found...
If I alter the controller like so:
from gluon import *
@auth.requires_login()
def testStarter():
"""This is to explore SQLFORM.smartgrid capabilities"""
grid = SQLFORM.smartgrid(db.owner,linked_tables=['dog'])
return locals()
that is, if I remove the fields=[db.owner.name] argument, everything (both
owner and dog grids) 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)
MySQL version: 5.1.41 from xampp 2.5.8
--
---
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.