I have this model, where I want to validate that the end_timeslot is not 
below the start_timeslot:

db.define_table('staffingexception',
                Field('employee_id', 'reference auth_user'),
                Field('from_date', 'date', required=True),
                Field('to_date', 'date', required=True),
                Field('from_location', 'reference location', required=True),
                Field('to_location', 'reference location', required=True),
                Field('start_timeslot', 'text', required=True),
                Field('end_timeslot', 'text', required=True),
                )

db.staffingexception.to_location.requires = IS_IN_DB(db, 'location.id', 
'%(name)s')
db.staffingexception.end_timeslot.requires = IS_EXPR(lambda value: int(value) > 
int(request.post_vars.start_timeslot),
                                                     error_message='Eindtijd 
moet na de starttijd liggen.')


This raises either True of False as an error, instead of passing it when 
the expression evaluates to True. What am I doing wrong?

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

Reply via email to