Manuele,

May I ask you how you did it?
This is my model:
db.define_table('Materiau',
    Field('mindex','string', compute=lambda r: '%s%s' %
(r.Nom,r.MType)),
    Field('MType', label='Type'),
    Field('Nom'),
    format='%(MType)s %(Nom)s')
db.Materiau.MType.requires=IS_IN_SET(('Tête','Armoire','Chassis'))
db.Materiau.mindex.requires=IS_NOT_IN_DB(db, db.Materiau.mindex)

Well, If I try to insert a duplicate with the appadmin insert form, it
goes through without rejection.
Or do I expect too much from the admin insert form?

On 5 jan, 12:26, Manuele Pesenti <[email protected]> wrote:
> I beg your pardon... it works!
> the problem was that I used 'unique' as the field name that is a not
> valid name :)
>
> so it coud be a solution to manage uniques
>
> bye
>      M.
>
> Il 05/01/2011 12:04, Manuele Pesenti ha scritto:
>
> > Trying quite the same solution I got a different error:
>
> > [omissis]
>
> > I used a string field as theuniquekey and the function called by
> > lambda returns a string.
>
> >     Manuele
>
>

Reply via email to