I tried this and it works for me: massimo-di-pierros-macbook:web2py mdipierro$ python web2py.py -S welcome -M (InteractiveConsole) >>> db.define_table('a',Field('b','date')) >>> db.a.insert(b='1776-07-04') 1
I think you may be running an old version of web2py On Sep 9, 12:22 am, jayvandal <jayvan...@gmail.com> wrote: > HI, > I get an error relating to strftime. > I had date fields in my database, but I wanted to enter old date such > as '1776-07-04' so I changed the fields to text and length of 10. > Then I was able to enter any date. > So I don't have any date fields anymore. But when I try to run a > simple elect all records and try to run it from the controller I ge > this error > Any Help will be appreciated > Jim > > AttributeError: 'str' object has no attribute 'strftime' > ===================================== > db.define_table('person', > Field('first_name', length=128), > Field('middle_name', length=128,default=''), > Field('last_name', length=128,default=''), > Field('death_date',length=10, requires=IS_NULL_OR(IS_DATE()), > comment='Example ex: 1975-09-20'), > Field('birth_date',length=10, requires=IS_NULL_OR(IS_DATE()), > comment='Example ex: 1975-09-20'), > Field('email', length=128,default=''), > Field('web_page', length=128,default=''), > Field('is_politician', 'boolean', default=True), > Field('is_business', 'boolean', default=True), > Field('is_education', 'boolean', default=True), > Field('is_government', 'boolean', default=True), > Field('is_military', 'boolean', default=True), > Field('password', 'password',readable=False,label='Password'), > Field('registration_key', length=128, > writable=False, readable=False, default='')) > > db.person.first_name.requires = [IS_NOT_EMPTY()] > db.person.last_name.requires = [IS_NOT_EMPTY()] > db.person.password.requires = [CRYPT()] # password will be stored > hashed > #db.person.email.requires = [IS_EMAIL(), IS_NOT_IN_DB(db, > db.auth_user.email)] > #t.web_page.requires --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web2py@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 -~----------~----~----~----~------~----~------~--~---