Thanks Massimiliano for the answering quickly. The suggested code produces 
this error:
IntegrityError(FOREIGN KEY constraint failed)

If I change the model file lines to 
db.define_table('next_list', Field('node'), Field('next_node', text))
then the error changes to:
NameError(name 'text' is not defined)


On Thursday, 6 July 2023 at 16:12:59 UTC+2 Massimiliano wrote:

> Maybe on your model there is more than you showed :
>
> db.define_table('next_list', Field('node'), Field('next_node'))
>
> db.next_list.insert(**db.next_list._filter_fields({ "node" : "test1" , 
> "next_node":"test2" }))
>
> print(db(db.next_list).select())
>
> next_list.id,next_list.node,next_list.next_node
>
> 1,test1,test2
>
>
> db.next_list.insert(**db.next_list._filter_fields({ "node" : "test1" , 
> "next_node":"test2" }))
>
> print(db(db.next_list).select())
>
> next_list.id,next_list.node,next_list.next_node
>
> 1,test1,test2
>
> 2,test1,test2
>
>
>
> Il giorno gio 6 lug 2023 alle ore 16:07 Rick <[email protected]> ha 
> scritto:
>
>> That unfortunately gives a ticket with this information:
>> sqlite3.IntegrityError: FOREIGN KEY constraint failed
>> On Thursday, 6 July 2023 at 15:02:05 UTC+2 Massimiliano wrote:
>>
>>> try this:
>>>
>>> {{db.next_list.insert(**db.next_list._filter_fields({ "node" : "test1"
>>>  , "next_node":"test2" }))}}
>>>
>>> Il giorno gio 6 lug 2023 alle ore 13:47 Rick <[email protected]> ha 
>>> scritto:
>>>
>>>> How to insert rows from a view-file? The site doesn't produce any 
>>>> error, but an empty row is added to the database.:
>>>>
>>>> From the model file
>>>> db.define_table('next_list', Field('node'), Field('next_node'))
>>>>
>>>>
>>>> From the view file:
>>>> {{nextrows = db(db.next_list)}}
>>>> {{db.next_list.insert(**db.next_list._filter_fields({ 
>>>> "db.next_list.node" : "test1" , "db.next_list.next_node":"test2" }))}}
>>>>
>>>>
>>>>
>>>> What's wrong? Thanks in advance for help and ideas!
>>>> ------------------------------
>>>>
>>>>
>>>> -- 
>>>> 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].
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/web2py/ac174d5a-8245-44e5-b708-08258a60f70fn%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/web2py/ac174d5a-8245-44e5-b708-08258a60f70fn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>>
>>>
>>> -- 
>>> Massimiliano
>>>
>> -- 
>> 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].
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/web2py/4e07ad77-4727-44a8-8710-bda5909cb287n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/web2py/4e07ad77-4727-44a8-8710-bda5909cb287n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>
>
> -- 
> Massimiliano
>

-- 
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/b59e89fc-3492-41cc-ae15-8c8d7cfae4ccn%40googlegroups.com.

Reply via email to