CORRECTION.

You problem is symply that

    SQLField('birth',requires=IS_DATE('%d/%m/%Y'),default=now)

should be

    SQLField('birth','date',requires=IS_DATE('%d/%m/%Y'),default=now)

this is why you have text instead of date in database. You may have to
clean it up.

Massimo

On Nov 22, 11:08 am, pmate <[EMAIL PROTECTED]> wrote:
> i get this error when calling appadmin/select/db/people
>
> at the beginning of the model i have:
> import datetime; now=datetime.date.today()
>
> and then:
> db=SQLDB('sqlite://mydb.db')
>
> so it is sqlite
>
> On 22 Nov, 17:53, mdipierro <[EMAIL PROTECTED]> wrote:
>
> > The code below is correct. When do you get the error? It is possible
> > now is a string instead of a datetime.date object?
> > Which database backend?
>
> > Massimo
>
> > n Nov 22, 10:13 am, pmate <[EMAIL PROTECTED]> wrote:
>
> > > Hi all,
>
> > > in model:
> > > db.define_table('people',
> > >     SQLField('surname'),
> > >     SQLField('birth',requires=IS_DATE('%d/%m/%Y'),default=now)
>
> > > but it gives me this error:
> > > return value.strftime(str(self.format))
> > > AttributeError: 'str' object has no attribute 'strftime'
>
> > > why?
>
> > > I even tried with:
> > > IS_DATE(T('%d/%m/%Y'),default=now))
> > > but it returns the same error
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to