Is there a one-to-many relationship here? If so, which is the one and which
is the many? If not, why not put everything in one table?
Anthony
On Thursday, December 15, 2011 10:09:21 PM UTC-5, JavierQQ wrote:
>
> Hi,
>
> I'm just trying to use again web2py :)
> I'm in kind of a trouble (it's not a web2py problem, it's actually a
> validation question)
> I have a Scale model
>
> db.define_table('scale', Field('name','string'),
> Field('group_id',db.groups)
> Field('min_v','integer'),
> Field('max_v','integer'),
> Field('category','string'))
>
> and Group model
>
> db.define_table('groups', Field('name','string'))
>
> I want to validate the existance of only 1 scale per group, for
> example
> Group 1:
> - scale 1 :
> ....
> - min_v : 0
> - max_v: 10
>
> - scale 2 :
> ....
> - min_v : 21
> - max_v: 30
>
>
> So when someone types (for example):
> - scale 3:
> - min_v :8
> - max_v: 23
>
> It won't be accepted, Is there a way of doing that?... I think it's
> more of a query problem and not a web2py issue,
> but I'll really appreciate the help
>
> Thanks in advance
>
> Javier Q.
>
>