I am lost for words & a-little infuriated at this point, a formula that has
been working & is working in other applications is not working today when
applied to another app!!
I am simply trying to get the number of days from the given dates but the
formula gives a NONE value! But i have applied it in the same as in other
apps, no changes at all!
CODE
from datetime import datetime
db.define_table('invoice',
Field('customer', 'reference Client_Details',writable=False,
label=SPAN('Customer', _style="font-weight: bold;")),
Field('client_order', label=SPAN("Item", _style="font-weight:
bold;"), requires=IS_NOT_EMPTY()),
Field('loaning_date', 'date', label=SPAN('Date Loaned',
_style="font-weight: bold;"), requires=IS_NOT_EMPTY()),
Field('returning_date', 'date', label=SPAN('Date Returned',
_style="font-weight: bold;"), requires=IS_NOT_EMPTY()),
Field('daysLoaned', 'integer', compute=lambda r: (datetime.
strptime(r['returning_date'], '%Y-%m-%d') - datetime.strptime(r[
'loaning_date'], '%Y-%m-%d')).days))
The highlited field saves a None value which is not what i am trying get!!
Please help!
Mostwanted
--
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/web2py/efd7de6c-9fa7-49da-818a-17cee6f2c024%40googlegroups.com.