Sorry for being pedantic!

I made an empty application with only a table in the model defined as:

db.define_table('test',Field('data','datetime'))

and inserted some datetimes.

then I made a method in the controller:

def getdata():
    rows = db(db.test).select()
    return dict(rows=rows)

and it works.

It works also:

def getdata():
    rows = db(db.test).select(db.test.data.year())
    return dict(rows=rows)

but if I try:

def getdata():
    rows = db(db.test).select(db.test.data.date())
    return dict(rows=rows)

web2py throws an exception with the message:

File "/home/angelo/DEV/web2py/applications/welcome/controllers/default.py",
line 13, in getdata
    rows = db(db.test.ALL).select(db.test.data.data())
AttributeError: 'Field' object has no attribute 'date'

So what's wrong?

Thank you!

2011/7/12 pbreit <pbreitenb...@gmail.com>:
> I believe datetime is a Python datetime.datetime object and gets validated
> by IS_DATETIME().
> http://docs.python.org/library/datetime.html#datetime.datetime
> http://web2py.com/book/default/chapter/07?search=IS_DATETIME
>

Reply via email to