for f in db.table.fields:
    if db.table[f].represent is None:
        db.table[f].represent = lambda value, row: value if value is not
None else '---'

Done!

Richard

On Mon, Oct 13, 2014 at 5:07 PM, <[email protected]> wrote:

> I've gotten several "complaints" from my users about fields that display
> the value None. In some cases the actual field value could be None verses
> the database field just being empty (and displaying the value None).
>
> I've started using represent when I describe my tables so that an empty
> field displays '---':
>    Field('aField',represent = lambda value,row: '---' if value == None
> else value)
>
> Is there a way to have web2py default  to display '---' for an empty
> database field? This would be much easier that updating my table
> descriptions.
>
> Thanks
>
> --
> 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