Closed onurmatik closed 14 years ago
Would it not be cleaner to pass the HTML through whatever filters you need by rendering them prior to adding them to InfoMap? e.g.:
InfoMap([ geom, Template("{{ thing|filter }}").render({'thing': thing}))])
Otherwise, you'd be forced to reconstruct the javascript array in the template, which seems to eliminate the point a bit. I mean, you could also just skip the Django InfoMap class altogether and invoke olwidget.InfoMap in the javascript directly, which would not be much different from what you're suggesting. The point of the Django class is to avoid having to write the javascript.
Makes perfect sense, thank you.
cool.
Hi,
In a case where I need to apply a template filter to the html passed to the info_map.html template, I need to access the info_array before it is rendered as a json string.
In my case, I am passing a link to an image as the html and applying a custom filter to create its thumbnail to be displayed on the map.
Thus, I suggest adding:
to the context used to render the info_map.html by the render() method of the InfoMap.
Thanks, omat