I think the problem is that db.post.insert(answers=report)
should be under if form.process().accepted: On Sunday, 2 April 2017 07:30:15 UTC-5, Maurice Waka wrote: > > I thought I had escaped/ solved this error. But now am stuck. My db.py > code: > > Post = db.define_table('post', > Field('message', 'text', requires=IS_NOT_EMPTY(), > notnull=False), > Field('answers', 'text', requires=IS_NOT_EMPTY(), > notnull=False), > auth.signature > )Post.is_active.readable=FalsePost.is_active.writeable=False > > controller: > > @auth.requires_login() > > def index(): > db.post.answers.writable=False > db.post.answers.readable=False > form = SQLFORM(post, formstyle='divs') > if form.process().accepted: > pass > messages = db(post).select(orderby=~post.created_on) > .......code > #after several codes in now need to post a message to answers field, > WITHOUT using a form in the view page > db.post.insert(answers=report) > > In my view: > > {{for msg in messages:}} > code{{=msg.message}}{{report from answers field}} > > My issue is that i keep getting the error: IntegrityError('NOT NULL > constraint failed:post.message. > > The two fields get data from different sources, post.message, from form in > view and post.answers from a function in the code. > > How do I solve this error? Kind regards > -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.