What is the difference between represent and format?

-Thadeus




On Thu, Jan 14, 2010 at 8:11 AM, mdipierro <[email protected]> wrote:

> You need web2py 1.74.6
>
> approval.define_table("config",
>            SQLField("name", "string", notnull=True),
>             SQLField("parent", 'reference config'),
>            format = lambda r:"%s [%s]" % (r.name,r.parent.name))
>
> approval.define_table("recipe",
>            SQLField("name", "string", notnull=True),
>            SQLField("config", approval.config))
>
> approval.config.parent.requires=IS_NULL_OR(IS_IN_DB(approval
> (approval.config.parent == None), 'config.id', "%(name)s", zero=None))
>
> This will be very slow if the list is long.
>
> On Jan 14, 5:41 am, rfx_labs <[email protected]> wrote:
> > Hi All,
> >
> > I have 2 tables in an one2many relation. Table "config" has a
> > selfreference.
> >
> > approval.define_table("config",
> >             SQLField("name", "string", notnull=True),
> >             SQLField("parent", 'reference config'))
> >
> > approval.define_table("recipe",
> >             SQLField("name", "string", notnull=True),
> >             SQLField("config", approval.config))
> >
> > approval.config.parent.requires=IS_NULL_OR(IS_IN_DB(approval
> > (approval.config.parent == None), 'config.id', "%(name)s", zero=None))
> > approval.recipe.config.requires=IS_IN_DB(approval, 'config.id', "%
> > (name)s")
> >
> > This works.
> > My Problem is to get a string in  pulldown for approval.recipe.config
> > like this "%(name)s [%(parent.name)s]".
> >
> > Any Ideas to achieve this?
> >
> > Martin
>
> --
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<web2py%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/web2py?hl=en.
>
>
>
>
--
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/web2py?hl=en.

Reply via email to