Hi gang

I am quite new to web2py and i am confronted to the following lack of my 
own knowledge.

In other DB engine one can write :

create table sometable (
    a_field varchar(10),
    b_field timestamp default date(now()),
    unique(a_field, b_field)
);

wich I have reproduce in web2py using the following syntax:

# coding: utf8
db.define_table('sometable',
                Field('a_field', 'string', length=10),
                Field('b_field','datetime', default=request.now),
                Field('unique_fields','text',compute=lambda s: 
str(s.a_field) + str(s.b_field), unique=True)
                )
db.sometable.requires = IS_NOT_IN_DB(db, 'sometable.unique_fields')

Written as is it works and I get a ticket when I try to create duplicate.

My question is : 

In some posts it is being said not to put the "unique=True" for the unique 
field.
I have tried it, (after deleting all databases files created by web2py) and 
the IS_NOT_IN_DB clause does not seem to work.

Any idea of what I am doing wrong ?

Regard's

Daniel L
    

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to