How about stripping the "notnull=True"?

If I'm right, your "default=False" option will replace null value by False.


On Fri, Oct 29, 2010 at 8:11 AM, Ruiwen Chua <[email protected]> wrote:
> Hi,
>
> I'm running into a little problem with boolean Field in my model. I
> have:
>
> db.define_table('message',
>        Field('sender', custom_auth_table, writable=False, required=True,
> notnull=True),
>        Field('text', 'string', length=2048, required=True, notnull=True),
>        Field('is_read', 'boolean', default=False, notnull=True),
>        format='%(msg_type)s by %(sender)s: %(text)s on %(created)s'
> )
>
> I'd like Messages to be unread by default, hence 'default=False' on
> the 'is_read' field.
>
> As expected, in appadmin, that gives me un unchecked checkbox.
>
> However, when trying to save the model in appadmin (and presumably
> other instances with forms validated by SQLFORM), I keep getting asked
> to input a value for that field. I'm unable to save a Message with the
> 'is_read' checkbox unchecked, ie. False.
>
> Am I doing something wrong here?
>
> //Ruiwen
>
>

Reply via email to