Reputation: 21
I want to create a controller with an SQLFORM.grid that shows only what the user submitted.
I have two tables: one for teachers(users) and another for students. The teachers submit the student's info. How can I use the grid to show the students submitted per user?
Upvotes: 1
Views: 164
Reputation: 321
You can apply a Common Filter to the table to limit what is shown. If you want to show only records created by a user then your filter might look like:
common_filter = lambda query: db.blog_post.created_by == auth.user_id
Upvotes: 1
Reputation: 23
use smart grid i.e SQLFORM.smartgrid() instead of normal grid and for teacher table add data filed students as list:string so that you can add multiple student names who submitted to a teacher id.
Upvotes: 0