On Thursday, May 10, 2012 8:36:18 PM UTC+10, rochacbruno wrote:
>
> db.define_table('nm', Field('a', notnull=True), Field('b', notnull=True),
> Field('unikey', unique=True))
>
> db.nm.unikey.compute = lambda row: row.a + row.b
>
Thanks, but that didn't work. I am able to push in multiple duplicat
I let the database (Postgresql) do the work using a constraint and then do
a
try:
except:
pass
in web2py.
Regards
Johann
--
Because experiencing your loyal love is better than life itself,
my lips will praise you. (Psalm 63:3)
If inserts into the table will be done via form submission and you don't
want to store an extra field in the table, another option is:
db.define_table('letter',
Field('name'),
Field('location',
requires=IS_NOT_IN_DB(db(db.letter.name==request.vars.name),
'letter.location')))
Tha
db.define_table('nm', Field('a', notnull=True), Field('b', notnull=True),
Field('unikey', unique=True))
db.nm.unikey.compute = lambda row: row.a + row.b
Em 10/05/2012 02:46, "Alec Taylor" escreveu:
> E.g.: For a letter to be unique and identifiable it needs unique(location
> && name)
>
> How do
E.g.: For a letter to be unique and identifiable it needs unique(location
&& name)
How do I make a requirement that a combination of fields must be unique?
Thanks for all information,
Alec Taylor
5 matches
Mail list logo