mysql - filter dropdown in sqlform,'Query' object is not callable -


I would like to insert a form with two fields: coursename, teacher_id (reference auth_user), but Shikshk_aidi field all ID Shows in Auth_user, I only want the role of the user's ID = Teacher to show in the dropdown. All users are in the same table (auth_user) I have done this: But this error shows: 'query' is not an object callable.

  query = (db.auth_membership.user_id == db.auth_user.id) (db.auth_membership.group_id == db.auth_group.id) (db.auth_group.role == 'teacher ') db.courses.teacher_id.requires = IS_IN_DB (dB (query),' auth_user.id ') form = SQLFORM (db.courses) return dict (form = form)  

thanks Xian

  query = (db.auth_membership.user_id == db.auth_user.id) ( Db.auth_membership.group_id == db.auth_group.id) (db.auth_group.role == 'teacher')  

the above does not validate the syntax. Set worthy object corner, and when the call is made, it is the second object, so you can set up chains:

  myset = db (query1) (query2) (query3 )  

If you want to work with query objects instead, you should do "and operator:

  myquery = query1 and query2 & Amp; Query3  

Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -