On Friday, April 8, 2016 at 12:44:38 PM UTC-7, Jeff Riley wrote:
>
> Hello all. I have the following if statement in my views to try to
> eliminate empty fields that are displaying "None" in my views. I am not
> sure how to get the field value to evaluate the statement. Any help
> appreciated.
>
> {{if customer.address2 == "None":}}
> Apt/Suite:<br/>
> {{else:}}
> Apt/Suite: <b>{{=customer.address2}}</b><br/>
> {{pass}}
>
Your sample code assumes "None" is a string, but you may actually be
getting the Python native value None. (str(None) is "None" ... which is
what you see on your page)
{{ if customer.address2 is None: }}
/dps
--
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.