The value for dentista is correct, is equal to Nominativi.id selected in drop-down list. When I insert or update the record with 'logo' empty the query is generated with '' instead of NULL and sqlite cannot parse the full query. if I update with db.Consulenze.insert(dentista=1240) it woks.
Il giorno giovedì 16 gennaio 2014 00:00:41 UTC+1, Anthony ha scritto: > > What value of dentista is being inserted, and have you confirmed that that > value is the id of one of the records in the Nominativi table? > > On Wednesday, January 15, 2014 5:56:18 PM UTC-5, Ivan Gazzola wrote: >> >> I've this table: >> db.define_table("Consulenze", >> Field('dentista','reference Nominativi', required=True), >> Field('data_inizio_collaborazione','date'), >> Field('data_fine_collaborazione','date'), >> Field ('percentuale','integer'), >> Field('logo','upload')) >> >> In console insert and update works but if i try to insert from SQLFORM >> without specifying the upload field I get this error: >> <class 'sqlite3.IntegrityError'> foreign key constraint failed >> and the query generated is: >> >> "INSERT INTO Consulenze(logo,data_inizio_collabor...sta,percentuale) >> VALUES ('',NULL,NULL,1240,NULL);" >> >> ^^ -->I think >> this is wrong and cuts the query before the required field!!! >> If I comment the upload file 'logo' all works fine .... >> >> ???? >> > -- 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/groups/opt_out.