hi, sorry, i missed that out, i think you can achieve it by modified your 
tables into :
    db.define_table('categories',
        Field('description_en', requires=IS_NOT_EMPTY()),
        Field('description_it', requires=IS_NOT_EMPTY()),
        Field('code', requires=IS_NOT_EMPTY()), 
format = '%(description_it)s')

    db.define_table('models',
        Field('code', unique=True, requires=IS_NOT_EMPTY()),
        Field('category_id', 'reference categories', 
requires=IS_NOT_EMPTY()),
        Field('description_en', requires=IS_NOT_EMPTY()),
        Field('description_it', requires=IS_NOT_EMPTY()),
        Field('pdf_path', requires=IS_NOT_EMPTY()), 
format = '%(code)s')

first thing is about reference type of field in models table. you use the 
integer type of field and the reference type of field to categories (2 
different type of field on the same field).
*before (bold is the root cause):*
Field('category_id', *'integer', *'reference categories', 
requires=IS_NOT_EMPTY()),
*after:*
Field('category_id', 'reference categories', requires=IS_NOT_EMPTY()),

second thing is about format, you want category_id in models table refer to 
categories table and show 'description_it' field, right? 
basically the reference type of field is refer to primary key of the table 
which is 'id' field, so if you want to use reference type of field and show 
'description_it' field, please use format on the categories table with 
value is description_it.
*format = '%(description_it)s'*

another thing about format, you can modified it, if  you using requires 
= IS_IN_DB e.g.
*Field('category_id', 'reference categories', requires = IS_IN_DB(db, 
db.categories.id, '%(description_it)s')),*

ref:
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer

best regards,
stifan

-- 
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].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to