I see. I think what you are seeing is due to a bug. I have fixed this
bug but I do not recall if it is fixed in only in trunk or also in
1.76.5. Which web2py version do you use?

Massimo

On Mar 28, 6:18 pm, Avik Basu <avikb...@gmail.com> wrote:
> I dropped all the records in the table and still get the same result.
> I replaced the previous represent with:
>
> represent = lambda x: type(x)
>
> which shows that the records are in fact of type datetime as opposed
> to string.  could the issue be in the rendering of tables in appadmin?
>
> Avik
>
> On Mar 28, 6:02 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > 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