Suppose I have an app that allows grandparents to enter, view, and edit
information about their children and grandchildren. I want to make sure
that each grandparent can see only his/her family's information and I want
to use SQLFORM.grid.
Using a query of the form
q = (db.children.parent == db.parent.id) & \
(db.parent.parent == db.grandparent.id) & \
(db.grandparent.user_id == auth.user.id)
form = SQLFORM.grid(q, ... )
yields a results page that works as expected. The form shows only the
grandchildren of the logged-in grandparent. However, if I click the Add or
Edit links, the dropdown for the parent reference shows all parent ids in
the entire parent table. How can I restrict the dropdown to show only the
parent ids contained in the record set from the query?
(Note: my actual app involves organizations, campuses, and buildings but
the hierarchical relationships are the same as in my example. Somehow
parent-child relationships seem easier to reason with. )
Thanks,
Mike
--