Re: [web2py] Re: Form validators: IS_IN_DB(..., _or=other_validator) ?

2014-05-25 Thread Louis Amon
It did the trick, thanks Anthony! By the way the difficult part for me was building the list containing all ids from multiple tables. Assuming ids are unique across tables (which was my case), this function can help build the IS_IN_SET validator : def mix(list_long, list_short): i,j =

[web2py] Re: Form validators: IS_IN_DB(..., _or=other_validator) ?

2014-05-23 Thread Anthony
How would you know whether the field stores an id of the melon table or the watermelon table? On Friday, May 23, 2014 4:52:58 PM UTC-4, Louis Amon wrote: Due to external constraints, I need to define two tables that are actually siblings and a third table's field that can choose from any of

Re: [web2py] Re: Form validators: IS_IN_DB(..., _or=other_validator) ?

2014-05-23 Thread Louis Amon
Well in this particular case I needn't know wether I'm storing a melon or a watermelon's id. I know it's kind of idiotic but I just need a 'fruit' id. Think of it as a subclassing matter : the API I'm connecting to is doing something along the lines of subclassing anyway, and I need to store

Re: [web2py] Re: Form validators: IS_IN_DB(..., _or=other_validator) ?

2014-05-23 Thread Anthony
I suppose you could just make it type='integer'. Then you could use the IS_IN_SET validator and construct a list of id's from the two tables (keeping in mind you should de-dup the list, as both tables will have many of the same id's). Of course, if you end up storing a value of say, 5, you