Thanks!

On Friday, August 2, 2013 9:48:49 PM UTC+8, Anthony wrote:
>
> You mean you get an error when inserting duplicate data? Note, unique=True 
> is enforced by the database, not web2py, so violating it will simply result 
> in a database error (which results in a web2py ticket if you don't 
> explicitly catch the error yourself). Instead, you want to use the 
> IS_NOT_IN_DB validator on that field -- that will result in an error 
> message being displayed on the form.
>
> Anthony
>
> On Friday, August 2, 2013 4:10:15 AM UTC-4, Mika Sjöman wrote:
>>
>> hi
>>
>> Got this field, to make sure that a booking is unique. 
>>
>> Field('booking_hash', unique=True, compute=lambda r: 
>> make_secure_val(str(r['bo_teacher_id']) + str(r['bo_lesson_date']) + 
>> str(r['bo_start_lesson_time'])+ str(r['bo_student_id']) )),
>>
>> Instead of getting an error poping up saying the record is not unique, I 
>> get a web2py error page. Anyone know how to solve this? This is my form:
>>
>> form = SQLFORM(db.booking)
>>     if form.accepts(request.vars, session):
>>         response.flash = T('yes')
>>         response(URL('booking_sent', vars={'booking':'[id]'}))
>>
>> Cheers!
>>
>

-- 

--- 
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/groups/opt_out.


Reply via email to