you're overriding the default IS_DATETIME() validator attached to datetime 
with IS_NOT_EMPTY() ... that's the reason it's not working.

On Wednesday, August 17, 2016 at 1:51:08 AM UTC+2, Luciano Laporta Podazza 
wrote:
>
> Hello,
>
> I'm working on a simple case file project and realized that working with 
> english date format has no issues but if I use spanish ones(taking 
> advantage of internacionalization) they don't get stored on database.
>
> Here is my controller:
> @auth.requires_login()
> def index():
>     """
>     example action using the internationalization operator T and flash
>     rendered by views/default/index.html or views/generic.html
>
>
>     if you need a simple wiki simply replace the two lines below with:
>     return auth.wiki()
>     """
>     form = SQLFORM.smartgrid(db.case_file)
>     return dict(form=form)
>
> Here is my model:
>
> db.define_table('case_file',
>     Field('auth_user_id', db.auth_user),
>     Field('case_file_number', 'integer', label=T("Case Number"), requires=
> IS_NOT_EMPTY()),
>     Field('case_file_code', 'integer', label=T("Case Code"), requires=
> IS_NOT_EMPTY()),
>     Field('case_file_letter', 'string', label=T("Case Letter"), requires=
> IS_NOT_EMPTY()),
>     Field('case_file_year', 'date', label=T("Case Year"), requires=
> IS_NOT_EMPTY()),
>     Field('case_file_subject', 'string', label=T("Case Subject"), requires
> =IS_NOT_EMPTY()),
>     )
>
>
> db.define_table('case_file_history',
>     Field('case_file_id', db.case_file),
>     Field('created_by', 'string', label=T("Created By"), requires=
> IS_NOT_EMPTY()),
>     Field('case_file_ingress', 'date', label=T("Case Ingress"), requires=
> IS_NOT_EMPTY()),
>     Field('case_file_egress', 'date', label=T("Case Egress"), requires=
> IS_NOT_EMPTY()),
>     Field('case_file_to', 'string', label=T("Case To"), requires=
> IS_NOT_EMPTY()),
>     Field('case_file_status', 'string', label=T("Case Status"), requires=
> IS_NOT_EMPTY()),
> )
>
>
> To recreate this issue, create a new project, use my code and set your 
> browser to spanish. It won't store any field of date type on database, but 
> if browser is set up in english language, it will.
>
> I'm using web2py 2.14.6-stable+timestamp.2016.05.10.00.21.47 on Mac OS X 
> El Capitan and sqlite or mysql(issue repeats on both databases).
>
> Any help will be appreciated. Thanks!
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to