I know this is way too old but is happening to me. After Massimo suggestion changes i get:
<class 'gluon.contrib.pg8000.ProgrammingError'> ('ERROR', '42804', 'column "fechaingreso__tmp" is of type date but expression is of type character varying') Any ideas. Regards, El miércoles, 9 de octubre de 2013, 20:03:50 (UTC-5), Massimo Di Pierro escribió: > > Field("the_date", > requires=IS_EMPTY_OR(IS_DATE()), > widget=SQLFORM.widgets.date.widget), > > should be > > Field('the_date',type='date') > > the requires and the widget are default. > > On Wednesday, 9 October 2013 13:41:11 UTC-5, Ryan Matlock wrote: >> >> I'm pretty new to web2py, so I'm probably making a silly mistake. In any >> case, the error goes something like this: >> >> In db.py, I have something like >> >> db.define_table("my_table", >> Field("name"), >> Field("the_date", >> requires=IS_EMPTY_OR(IS_DATE()), >> widget=SQLFORM.widgets.date.widget), >> format = "%(name)s") >> >> Then I go to the appadmin and pick a date using the widget, and end up >> with something like "2013-10-09". When I submit it, I get an internal >> error, and it seems that the relevant parts of the ticket are the following: >> >> Traceback (most recent call last): >> File >> "/Applications/web2py/web2py.app/Contents/Resources/gluon/restricted.py", >> line 217, in restricted >> File >> "/Applications/web2py/web2py.app/Contents/Resources/applications/service/views/appadmin.html", >> >> line 189, in <module> >> File >> "/Applications/web2py/web2py.app/Contents/Resources/gluon/sqlhtml.py", line >> 2924, in __init__ >> File "/Applications/web2py/web2py.app/Contents/Resources/gluon/dal.py", >> line 9641, in formatter >> File >> "/Applications/web2py/web2py.app/Contents/Resources/gluon/validators.py", >> line 2701, in formatter >> File >> "/Applications/web2py/web2py.app/Contents/Resources/gluon/validators.py", >> line 2277, in formatter >> AttributeError: 'str' object has no attribute 'year' >> Error snapshot help >> <type 'exceptions.AttributeError'>('str' object has no attribute 'year') >> >> and >> >> Function argument list >> >> (self=<gluon.validators.IS_DATE object>, value='2013-10-09') >> >> I'm a little confused as to why the validator is confused by a date >> properly formatted by the date widget. When I comment out the >> "requires=IS_EMPTY_OR(IS_DATE())" line in my db.py file, the error goes >> away. >> > -- 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.