I created a simple table that uses another table as a list of possible 
values for a field:

db.define_table('country',
Field('name','string',length=DEFAULT_STRING_LENGTH))

db.define_table('company',
Field('name', 'string',
requires=IS_NOT_EMPTY(error_message=auth.messages.is_empty)),
Field('address', 'string',
Field('country','reference country',
requires=IS_IN_DB(db,db.country.id)))

This is all very simplistic, and I just want to have the ID in the dropdown 
(later to be replaced by something like 
'represent=db.country.name(db.country.id))', but it does not work as it 
is...

The form shows up, I need to put something in the NAME field and choose 
something for the COUNTRY field - otherwise the validators complain - but 
aftwerwords I systematically get:

<class 'sqlite3.IntegrityError'> foreign key constraint failed

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