[web2py] Re: How to ensure each row in the db table having distinct value of a partcular field?

2016-04-20 Thread Michael Beller
unique=True assures the value is unique at the database level but does not 
add a form validator.

In addition to unique=True, you can add a validator like this:

db.person.username.requires = IS_NOT_IN_DB(db, 'person.username')

from the book:
http://web2py.com/books/default/chapter/29/07/forms-and-validators#IS_NOT_IN_DB



On Tuesday, April 19, 2016 at 2:32:15 AM UTC-4, mfarees...@gmail.com wrote:
>
> Field('username', unique=True)
>

-- 
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.


[web2py] Re: How to ensure each row in the db table having distinct value of a partcular field?

2016-04-19 Thread mfarees . knysys
Field('username', unique=True)

-- 
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.