[web2py] Re: Creating a validator to limit the number of table entries

2021-12-12 Thread mostwanted
Thank you, really. On Sunday, December 12, 2021 at 3:46:40 PM UTC+2 Clemens wrote: > Now parent is a valid row object, that can be referenced by parent.id. If > it delivers what you want to, it's fine! > > Best regards > Clemens > > On Sunday, December 12, 2021 at 2:42:31 PM UTC+1 mostwanted wro

[web2py] Re: Creating a validator to limit the number of table entries

2021-12-12 Thread Clemens
Now parent is a valid row object, that can be referenced by parent.id. If it delivers what you want to, it's fine! Best regards Clemens On Sunday, December 12, 2021 at 2:42:31 PM UTC+1 mostwanted wrote: > So i decided to do this & seems to be working, I hope it fall apart, > please advice if i

[web2py] Re: Creating a validator to limit the number of table entries

2021-12-12 Thread mostwanted
So i decided to do this & seems to be working, I hope it fall apart, please advice if i'm wrong. I added the validator function inside the registration function & called it from the process() function, its working, i hope it wont fall apart. def registration(): parent=db.parent(request.args

[web2py] Re: Creating a validator to limit the number of table entries

2021-12-12 Thread mostwanted
What I want is to prevent more than 10 entries of children per selected parent On Sunday, December 12, 2021 at 1:45:31 PM UTC+2 Clemens wrote: > Hello! > > Your are not referencing the parent table. I think, what you want to > address, is as follows: > if db((db.*parent*.id>0) & (db.children.p

[web2py] Re: Creating a validator to limit the number of table entries

2021-12-12 Thread Clemens
Hello! Your are not referencing the parent table. I think, what you want to address, is as follows: if db((db.*parent*.id>0) & (db.children.parent==parent.id)).count() >=10: ... Then the error should not occur and you are get all parents with more than 10 children. Regards Clemens On Su