On Aug 1, 3:32 am, Alastair Medford <alastairmedf...@gmail.com> wrote: > > db.student.student_id.requires=IS_NOT_IN_DB(db,'student.student_id') > > db.tasks.student.requires=IS_IN_DB(db,'student.id','%(student_id)s') > > db.tasks.student.represent=lambda id: db.student[id].student_id > This seems to accomplish what I was trying to do, thanks. However, I'm > in the dark as to what some of the syntax is. In the second line, I > know that the third argument has something to do with how the drop > down box chooses it's contents, but I do not understand the syntax of > '%(student_id)s'. Also, in the 3rd line I do not know what "lambda id: > " is doing. If this is standard python fare, then I apologise as I'm > still learning python and all it's syntax tricks. Thanks again.
These are both std Python. '%(student_id)s' => replace '' with the value of student_id lambda functions allow you to use a little program to fill in the value so lambda id: db.student[id].student_id says 'use the value of this cell within the formula db.student [value].student_id' http://diveintopython.org/power_of_introspection/lambda_functions.html F --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---