can you please open an issue on google code (add a link this thread).

On Apr 14, 3:06 am, szimszon <szims...@gmail.com> wrote:
> Sorry for late answer (never got an email replay...)
>
> So:
>
> -- db.py --
> db.define_table( 'mail_domain',
>     Field( 'domainname', 'string')
> )
>
> db.define_table( 'mail_domain_alias',
>     Field( 'mail_domain_id', db.mail_domain,
>            requires = IS_IN_DB( db, db.mail_domain.id, '%
> (domainname)s' ),
>             writable = False,
>         ),
>     Field( 'alias', 'string' ),
> )
> -- db.py --
>
> -- controller default.py --
> def index():
>     if db(db.mail_domain.id>1).count()==0:
>         db.mail_domain.insert(domainname='oregpreshaz.eu')
>
> db.mail_domain_alias.mail_domain_id.default=int(db(db.mail_domain.id>0).sel 
> ect(orderby=db.mail_domain.id).last().id)
>     db.mail_domain_alias.mail_domain_id.writable=False
>     return
> dict(form=crud.update(db.mail_domain_alias,request.args(0)))
>
> -- controller default.py --
>
> With db.mail_domain_alias.mail_domain_id.writable=False in controller
> (or in db.py) you could see only the "Mail Domain Id:" number like 1.
> With db.mail_domain_alias.mail_domain_id.writable=True in controller
> (or in db.py) you could see the "Mail Domain Id:" as domainname like
> 'oregpreshaz.eu'.
>
> I wish I could see the domainname and not the id if .writable=False
>
> I think that was a behavior before. And if you make display a table
> representation of a select the reference isn't replaced with the
> format and show only the id number...
>
> On ápr. 4, 15:26, Massimo Di Pierro <massimo.dipie...@gmail.com>
> wrote:
>
>
>
>
>
>
>
> > It would help to have a smaller example to understand the problem
> > better. Can you reproduce it with one table with 1-2 fields and one
> > action?
>
> > On Apr 4, 5:30 am, szimszon <szims...@gmail.com> wrote:
>
> > > Can I help with something?
>
> > > On márc. 30, 08:55, szimszon <szims...@gmail.com> wrote:
>
> > > > Any progress / comment?
>
> > > > On márc. 27, 22:04, szimszon <szims...@gmail.com> 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

Reply via email to