Hello
I want to display thumbnails ,which reside in a firebird
database blob field in a datagrid.
I have following so far:
The grid displays id and date columns fine but
the thumbnails are not shown :
class MakeImgTag(Widget):
params = ['field']
template="""<img src='${tg.url(field)}'></img>"""
def widget_getter(widget, field,**kw):
def getter(obj,**kw):
row=obj.id
return widget.display(field=getattr(row, field, ''))
return getter
# controller
@turbogears.expose(template="turbogallery.templates.photoindex")
@turbogears.paginate('data',default_order='date')
def photoindex(self,**kw):
photos_field_form=PaginateDataGrid(fields=[DataGrid.Column('id','id','ID',options=dict(sortableble=True)),DataGrid.Column('date','date','DATE',options=dict(sortable=True)),DataGrid.Column('thumbnail',widget_getter(MakeImgTag(),'thumbnail')),])
return dict(data=Photo.select(orderBy='-
date'),list_widget=photos_field_form)
Thanks for any ideas.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---