t2.update() displays reference fields like defined in requires= It
retrieves and displays the values from the referenced table.

t2.display() does only display the numeric id value of the referenced
table.

what code is required to get t2.display show values of selected fields
in the referenced table instead?

code example below.

Hans



db.define_table('model_category',
    SQLField('code','string',length=3,required=True,
       requires=[IS_NOT_EMPTY(),IS_NOT_IN_DB
(db,'model_category.code')],unique=True),
    SQLField('text','string'))
db.model_category.represent=lambda model_category: A
(model_category.code + ' ' + model_category.text,_href=t2.action
('display_model_category',model_category.id))

db.define_table('model',
    SQLField('code','string',required=True,
       requires=IS_NOT_EMPTY(),IS_NOT_IN_DB
(db,'model.code')],unique=True),
    SQLField('description','string',length=64,default=None),
    SQLField('successor_of','reference model_master',
       requires=IS_NULL_OR(IS_IN_DB(db,'model.code'))),
    SQLField('category','reference model_category',
       requires=IS_NULL_OR(IS_IN_DB(db,'model_category.id','%(code)s %
(text)s'))))

def display_model():
    item=t2.display(db.model)
    return dict(item=item)

def update_model():
    item=t2.update(db.model)
    return dict(item=item)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to