Could it be possible that default value is wrong? Wouldn't better be None?
It a bit difficult to say what the problem is without the full table
definition and full traceback (at least more detailed one).

Richard

On Wed, Nov 16, 2016 at 3:35 AM, 'Annet' via web2py-users <
[email protected]> wrote:

> In a table I defined the following field:
>
> Field('birthday', writable=False, readable=False, **isemptyorisdate),
>
> isemptyorisdate has been defined like this:
>
> isemptyorisdate = dict(type='date', default='',
> requires=IS_EMPTY_OR(IS_DATE(format='%d-%m-%Y',
>                               error_message='No match dd-mm-yyyy')),
> represent=lambda v: v.strftime('%d/%m/%Y') if v else '')
>
> In web2py's admin this works, however, when I define an update function
> containing the following lines of code:
>
>
> db.vtx_person.birthday.readable = db.vtx_personbirthday.writable = True
> form = SQLFORM.factory(db.vtx_person, db.lct_address,
>         Field('phonenumber', length=128, requires=IS_LENGTH(128)),
>         Field('mobilenumber', length=128, requires=IS_LENGTH(128)),
>         Field('email', length=128, requires=[IS_LENGTH(128), IS_EMAIL()]),
>         Field('URL', length=128, requires=IS_EMPTY_OR(IS_URL(
> prepend_scheme=None))))
>
>
> I get the following error:
>
> <type 'exceptions.AttributeError'> 'str' object has no attribute 'year'
> When I comment out the line :
>
> db.vtx_person.birthday.readable = db.vtx_personbirthday.writable = True
>
> I do not get the error. In appadmin/update/db/vtx_person the birthday
> field is rendered like this:
>
> <input id="vtx_person_birthday" class="date form-control" name="birthday"
> value="" type="text">
>
>
> How do I solve tis ussue?
>
>
> Kind regards,
>
> Annet
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to