On Thursday, July 7, 2016 at 12:32:08 PM UTC-7, Alfonso Serra wrote:
>
> If i define a boolean field as:
>
> Field("mybool", "boolean", required = False, notnull = False, default = 
> None)
>
> Its stored as False if its not present in request.post_vars. The proper 
> behaviour would be to store a null value in this case, which allows to 
> handle boolean's tri-states.
>
> To achieve bool tri states i have to hack the form after is processed like:
> if request.post_vars.mybool == None:
>     form.vars.mybool = None
>
> Is there an easier/cleaner way to achieve this?
>
> Thanks.
>

Which backend are you using for the database?  I think the adapters have to 
be aware of the backend's way of handling booleans.

/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.

Reply via email to