I thought there was an easier way. I didn't think of just passing it in with db in the first place. Thanks
On Jul 9, 12:35 am, David Marko <[email protected]> wrote: > You can use full DAL query in IS_IN_DB validator e.g. > IS_IN_DB(db(db.children.sex=='M'),'children.id','%(name)s' ) > > David > > On 9 čnc, 08:08, Alastair Medford <[email protected]> wrote: > > > As it stands, when one places the IS_IN_DB validator on a field, you > > get a select list with options of all the rows in the given table. > > This is great, but now I'm looking for a little more functionality. > > For my application I'm looking to filter the selection down to a given > > db requirement. For example, instead of a list of all the students in > > a table, I want all students who is in class x (so the relationship > > could be something like db.student.class="5A"). I know I could easily > > accomplish this manually, but my project dictates that these forms > > will always be generated. > > > I've looked into the code of the IS_IN_DB validator, and it looks like > > to achieve this I could add an argument to it that takes a query (None > > by default), and simply change the line: > > > records = self.dbset.select(*self.fields, **dd) > > to > > records = self.dbset(query).select(*self.fields, **dd) > > > Is this all it would take? Would this be useful to anyone else? Should > > this feature be somewhere else? > > I've yet to contribute to an open source project, and I don't really > > know how the process works. > > Thanks.

