db.pontos.dt_entrada.requires=IS_NULL_OR(IS_DATETIME())
On Feb 17, 2:39 pm, dewes <rde...@gmail.com> wrote:
> When I create a table like this:
>
> db.define_table('pontos',
> SQLField('nome','string'),
> SQLField('destino','string'),
> SQLField('dt_entrada','datetime'),
> SQLField('dt_saida','datetime')
> )
>
> db.pontos.nome.required = IS_NOT_EMPTY()
> db.pontos.destino.required = IS_NOT_EMPTY()
>
> and make this controller:
>
> def controle_ponto():
> form = SQLFORM(db.pontos)
> if form.accepts(request.vars,session):
> response.flash='ok'
> return dict(form=form)
>
> it keep saying that I have to fill both dates even if I didn't make
> they required. I had also tried to set them notnull=False,
> required=False, but it didn't helped.
>
> The solution that I found was to make FORM() and insert after.
>
> By the way, pretty cool the little calendar to fill dates when you
> click on a datetime input made by the sqlform.
--~--~---------~--~----~------------~-------~--~----~
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
web2py+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---