Any progress / comment?
On márc. 27, 22:04, szimszon <[email protected]> wrote: > Hi! > > I use Version 1.94.6 (2011-03-27 18:20:38). > > I have in db: > ------------------------- > db.define_table( 'mail_domain', > Field( 'domainname', > 'string', > > label = 'Domain név', > > requires = IS_NOT_EMPTY() > > ), > signature, > migrate = > settings.migrate, > ) > db.define_table( 'mail_domain_alias', > Field( > 'mail_domain_id', db.mail_domain, > > label = 'Domain név', > > requires = IS_IN_DB( db, db.mail_domain.id, '% > (domainname)s' ), > > *********writable = False,********* > > ), > Field( 'alias', > 'string', > > label = 'Aliasz', > > requires = IS_NOT_EMPTY() > > ), > signature, > migrate = > settings.migrate, > ) > -------------- > > controller: > > ---------------- > def domain(): > form = crud.update( db.mail_domain, request.args( 0 ) ) > return dict( form = form ) > def domainalias(): > db.mail_domain_alias.mail_domain_id.default = session.domainname_id > form = crud.update( db.mail_domain_alias, request.args( 0 ) ) > return dict( form = form ) > def setdomain(): > session.domainname_id = request.args( 0 ) > session.domainname = db( db.mail_domain.id == > session.domainname_id ).select( db.mail_domain.domainname ).first().domainname > redirect( URL( 'default', 'index' ) ) > ----------------- > > If the session.domainname_id is set to a valid mail_domain record ID, > than the crud in domainalias shows the reference field as number and > not as domainname string. > > But if I remove the writable=False in mail_domain_alias table's > mail_domain_id field than I have a dropdown menu with the right record > selected as domainname and not as ID number. > > I think the right behavior would be if I set the writable = True that > I would see the right record not as ID but as %(domainname)s

