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/CANPTPxKJd3QTwhA8TCmbVFczkkC87YOt6CviNwCL9Us%2BF10VNA%40mail.gmail.com.