ruko schrieb: > "Diez B. Roggisch" <[email protected]> wrote: >> >> from genshi import Markup >> >> def get_link(item): >> return Markup("""<a href="%s" >Link</a>""" % item.link) >> >> Diez > > sorry, but I didn't get it. > > An example: > ------------------------------- > name_grid = [("Edit", "id"), ("Name", "name"), ("Birth", "birth")] > > class RootController(BaseController): > # some others ... > @expose("genshi:namecollection.templates.names_list") > def list(self, **kw): > """a simple list for Names""" > names = DBSession.query(Names) > pylons.c.name_grid=DataGrid(fields = name_grid) > pylons.c.name_data=DBSession.query(Names).all() > return dict(names=names, page='Name List') > ----------------------------- > > I would like to have a link <a href="/edit/value_of_id">Edit</a> in > the resulting grid in stead of the (value of the) id. > > What's the code for that?
Use the function mentioned by Diez as field accessor (second element in the tuples defining the Columns). Seems we need some documentation here; I just opened a ticket for that (http://trac.turbogears.org/ticket/2235). -- Christoph --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" 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/turbogears?hl=en -~----------~----~----~----~------~----~------~--~---

