Hi all,
I've a simple model like this
db.define_table("lot",
Field('name', 'string', length=1024, required=True, unique=True),
Field('start_date, 'date', required=True)
)
db.lot.start_date.requires =
IS_DATE(format=T('%Y-%m-%d'),error_message=T('must be YYYY-MM-DD!'))
And I have a custom CSV import that implies multiple tables including this
one.
db.lot.insert(
name=line["NAME"],
start_date=line["S_DATE"]
)
(line is a csv row)
However the S_DATE column has format DD/MM/YYYY
I'm working with git trunk and using Postgres and (magically?) all imported
dates are correct, I mean, there are no errors and there is no confusion
between dd/mm/yyyy and mm/dd/yyyy for dates like 06/04/2012
How this can be possible? It's because of my development machine or
postgres locale? (My language file is not in web2py yet so the web
interface is in english and so the date format in admin app database
administration is yyyy-mm-dd, just to clarify that this is not because of T
in format)
Anyway, the question is how can I define/ensure that such dates will be
always well inserted when importing the CSV?
Because looks like the requires is_date format is not affecting the
db.table.insert, is it?
Thanks in advance,
Miki
--
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.