I would like to have a smartgrid that references its parent table in
linked_tables, what is the web2py way of doing this? I have found some help
in this thread:
https://groups.google.com/forum/?fromgroups=#!topic/web2py/vDGJdct550Q but
the solution is a bit sketchy due to it modifying sqlhtml.py.
Lets take this model:
db.define_table(
'contact',
Field <http://www.web2py.com/examples/global/vars/Field>('name'),
Field <http://www.web2py.com/examples/global/vars/Field>('address'),
format = '%(name)s')
db.define_table(
'courses',
Field
<http://www.web2py.com/examples/global/vars/Field>('student_id',db.person),
Field <http://www.web2py.com/examples/global/vars/Field>('course_name'),
Field <http://www.web2py.com/examples/global/vars/Field>('pass_mark',
'text'),
format = '%(name)s')
I want a smartgrid for courses that shows all the courses records and has
the contact table in linked tables. That way I have an easy way to view all
course data and easily check out the contact data of the person doing the
course. This smartgrid is used by people who mark courses and require quick
access to the data in the courses table without having to go via the
"contact" table.
In a perfect world I would create this smartgrid like so:
def courseview():
form = SQLFORM.smartgrid(db.courses,linked_tables=['contact'])
return locals()
However this does not work because the contact table is the parent.
What is the best way of achieving my required result?
--
---
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.