Re: [web2py] Re: enforcing a one-to-one relationship

2010-01-11 Thread Jeff Bauer
Still fails for me on a record update: 'value already in database' -Jeff On 01/10/2010 09:53 PM, mdipierro wrote: That is easy to fix. In fact it is now fixed in trunk. On Jan 10, 9:42 pm, Jeff Bauer wrote: There's a further problem here. The scheme below also prevents socdiag from ever

[web2py] Re: enforcing a one-to-one relationship

2010-01-10 Thread mdipierro
That is easy to fix. In fact it is now fixed in trunk. On Jan 10, 9:42 pm, Jeff Bauer wrote: > There's a further problem here.  The scheme below also > prevents socdiag from ever being updated, because once > the record is created then IS_NOT_IN_DB always fails. > > -Jeff > > On 01/10/2010 09:28

Re: [web2py] Re: enforcing a one-to-one relationship

2010-01-10 Thread Jeff Bauer
There's a further problem here. The scheme below also prevents socdiag from ever being updated, because once the record is created then IS_NOT_IN_DB always fails. -Jeff On 01/10/2010 09:28 AM, mdipierro wrote: Good point. Perhaps the _and solution is not a good one. On Jan 10, 7:59 am, Jeff B

[web2py] Re: enforcing a one-to-one relationship

2010-01-10 Thread mdipierro
Good point. Perhaps the _and solution is not a good one. On Jan 10, 7:59 am, Jeff Bauer wrote: > Working from changeset 94:4fd248d09b52, the unique column is > enforced, but the dropdown is missing.  It is replaced by a > text (string) entry field.  If I add the following code to > db.py, the dro

Re: [web2py] Re: enforcing a one-to-one relationship

2010-01-10 Thread Jeff Bauer
Working from changeset 94:4fd248d09b52, the unique column is enforced, but the dropdown is missing. It is replaced by a text (string) entry field. If I add the following code to db.py, the dropdown reappears: db.socdiag.socform.requires = \ IS_IN_DB(db, 'socform.id', _and=IS_NOT_IN_DB(d

[web2py] Re: enforcing a one-to-one relationship

2010-01-09 Thread mdipierro
Try this again with the code in trunk. assuming you have a format db.define_table('socform',...,format="") you will get a default validator db.docfiag.socform.requires=IS_IN_DB(,_and=IS_NOT_IN_DB(...)) that will make both the dropdown and the reference unqueness enforced by the validato

[web2py] Re: enforcing a one-to-one relationship

2010-01-09 Thread mdipierro
I think sqlite may not enforce this. You can achieve this with validators but I think I can make it easier with an upgrade I am working on... tomorrow. On Jan 9, 5:30 pm, Jeff Bauer wrote: > I'm trying to enforce a one-to-one relationship between > tables socdiag and socform with unique: > > db.d