None is a Python object, not a string value, so it would be:
if customer.address2 is None:
You could also do:
if customer.address2:
which will evaluate to False if the address is None or if it is an empty
string ('').
Anthony
On Friday, April 8, 2016 at 3:44:38 PM UTC-4, 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}}
>
--
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.