Basic example:
db.define_table('contact',
Field('contract_start','date'),
Field('contract_length','string'),
Field('contract_renewal','date', writable=True, readable=True,
compute=lambda r: (r['contract_start']+r['contract_length']))
db.contact.contract_start.requires = IS_DATE(format=T('%m-%d-%Y'),
error_message='Must be MM-DD-YYYY!')
db.contact.contract_renewal.requires = IS_DATE(format=T('%m-%d-%Y'),
error_message='Must be MM-DD-YYYY!')
db.contact.contract_length.requires = IS_IN_SET(['6 months', '1 year',
'2 year's, '3 years'])
Thanks. As far as the DAL goes, I am using SQLite, and I know I can do
something like this to add a specific time period to a date by using
the following statement -
INSERT date('now','+10 day');
Is there a DAL equivalent? I didn't see anything in the book. Seems
like this would be too low of a function to be part of the DAL.
> --
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
>
https://groups.google.com/d/topic/web2py/f-14OLOhKpM/unsubscribe?hl=en.
> To unsubscribe from this group and all its topics, send an email to
>
web2py+un...@googlegroups.com.
> For more options, visit
https://groups.google.com/groups/opt_out.
>
>