Great Antony!. But wait, now I have a new issue:
IntegrityError: NOT NULL constraint failed: post.message

On Sat, Apr 1, 2017 at 10:49 PM, Anthony <abasta...@gmail.com> wrote:

> It is not clear what you are trying to do. You can only insert values in
> fields that exist -- there is no "name" field in your table, so you cannot
> insert a value for a "name" field. If you want to insert a value for
> "reply", then you must specify the "reply" field:
>
> db.post.insert(reply='report')
>
> Where does "name" come from in this scenario?
>
> Anthony
>
>
> On Saturday, April 1, 2017 at 11:56:41 AM UTC-4, Maurice Waka wrote:
>>
>> I have this:
>> Post =define_table('post'
>>                             Field('message', 'text',
>> requires=IS_NOT_EMPTY, notnull=True),
>>                             Field('reply', 'text', requires=IS_NOT_EMPTY).
>>                             auth.signatue
>>         )
>> Post.is_active.readable=False
>> Post.is_active.writable=False
>>
>> controller:
>>
>> def index():
>>     code....
>>     db.post.reply.insert(name='report').....to insert into the reply
>> collumn
>>
>> I get error that:
>> AttributeError:'Field' object has no attribute 'insert'
>>
>> If I use:
>> db.post.insert(name='report')
>>
>> SyntaxError: Field name does not belong to the table
>>
>> I thought/Learned that to insert: you do e.g.
>>
>> db.person.insert(name="Luca")
>>
>> db.commit()
>> What am i doing wrong, and how can i correct it?
>> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/web2py/u801DTQdpHE/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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

Reply via email to