Hi friends,
I've two tables: one "*POI*" (Point Of Interest, like google maps) and the
other "*icons*".
Single "POI" can have only one icon, as marker's image.
An icon can be chosen by many POI.
I use crud to create, read, update and delete POI and I want to give user
the possibility to choose an icon from the icons table. I'm using a
radiobutton list, but I want to show images instead of filenames.
Now I have these radiobutton when I want "create" or "update":
- Icons.icon.a623c79f48dc3152.74656e6e69732e706e67.png
- Icons.icon.b72d7641f2001b0c.6368757263682d322e706e67.png
*How can I show images in the radiobutton instead of strings?*
Code:
db.define_table('Icons',
Field('name', 'string' ),
Field('icon', 'upload'))
db.Icons.icon.represent = lambda r, v: IMG(_src=URL('default', 'download',
args=v.icon))
db.define_table('POI',
...
...
Field('icon', widget=SQLFORM.widgets.radio.widget))
db.POI.icon.requires = IS_IN_DB(db, db.Icons.icon)
db.POI.icon.represent = lambda r, v: IMG(_src=URL('default', 'download',
args=v.icon))
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.