Right, that seems to work, thanks! I'm a little puzzled as to why these two options should conflict in this case though? Doesn't the notnull=True option simply prevent the field from holding a NULL value, while the default= option does in fact provide a value by default (hence avoiding a NULL)?
On Oct 29, 6:51 pm, Vinicius Assef <[email protected]> wrote: > 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

