>
> Thanks Richard, Anthony, very good answers.
>
The use case is simple:
For example, query articles with a field of uncatalogued, you can either
select catalogued, uncatalogued or all (doesnt matter if its uncatalogued).
To store such filter i can make use of a boolean tri state, True, False or
None to generate the right query.
@Richard
thats exactly what i meant. In the field declaration "default=None" doesnt
do anything since it will be populated as "False" no matter what.
I can agree with Anthony to a certain point that an undeclared boolean
value should always be False. The most common representation of a boolean
value is a checkbox, but it could be a radio input with 3 values. ["", 1, 2]
In this case it would be like:
Field("mybool", "boolean", required = False, notnull = False, default =
None,
filter_in=lambda v: None if v is None else v)
Since the boolean is represented as a radio input.
Thanks Anthony thats a fair solution for this case. Ill go with that.
--
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.