It is possible you chaged the type of this field from 'string' to
'datetime' and because sqlite does not support migrations, you may
have still string data in the datetime field. I suggest you delete
those records that contain corrupted data.

Massimo

On Mar 28, 4:54 pm, Avik Basu <avikb...@gmail.com> wrote:
> I would like to use the represent function on a datetime object, like
> so:
>
> from datetime import *
>
> db.define_table("adate",
>   Field("date","datetime",
>      represent = lambda x: x.strftime("%a %m-%d-%y") if x else 'No
> time'  #convert datetime object to string
>   )
> )
>
> This works when I create a form, however when i use appadmin it gives
> the following error:
>
> Traceback (most recent call last):
>   File "gluon/restricted.py", line 173, in restricted
>   File "/Applications/web2py.app/Contents/Resources/applications/
> FWv7_7/views/appadmin.html", line 196, in <module>
>   File "gluon/sqlhtml.py", line 1103, in __init__
>   File "gluon/sql.py", line 2676, in formatter
>   File "gluon/validators.py", line 2006, in formatter
> AttributeError: 'str' object has no attribute 'strftime'
>
> Avik

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to