Thanks Anthony.
On Friday, December 11, 2015 at 12:01:41 AM UTC+5:30, Anthony wrote:
>
> From the book:
>
> Notice that requires=... is enforced at the level of forms, required=True
> is enforced at the level of the DAL (insert), while notnull, unique and
> ondelete are enforced at the level of the database. While they sometimes
> may seem redundant, it is important to maintain the distinction when
> programming with the DAL.
>
> "unique" is enforced by the database and has nothing to do with forms. If
> you want validation of form input with nice error messages displayed in the
> form, you must use validators, documented in the Forms chapter. In this
> case, you want requires=IS_NOT_IN_DB(...).
>
> Anthony
>
> On Thursday, December 10, 2015 at 12:58:28 PM UTC-5, Jitun John wrote:
>>
>> Hi,
>>
>> I am trying to create a table which accepts log files.
>> One of the entries that should be unique is log path. No Duplicate
>> entries.
>>
>> db.define_table('logs_db',
>> Field('case_num', requires=IS_NOT_EMPTY()),
>> Field('case_desc',),
>> Field('log_gen_time', writable=False, readable=False),
>> Field('log_uniq_name', writable=False, readable=False,
>> unique=True),
>> Field('log_path', unique=True, requires=IS_NOT_EMPTY()),
>> auth.signature)
>>
>>
>> I am now using the above format.
>> Even with unique=True The form gets submitted.
>> I would have liked the form to be able to check if there is another entry
>> for log_path, but it doesn't.
>> I have tried *primarykey=['log_path'] *as well, but to no affect.
>>
>> I am using SQLite.
>>
>>
>>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.