diff options
Diffstat (limited to 'chimere/main/models.py')
-rw-r--r-- | chimere/main/models.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/chimere/main/models.py b/chimere/main/models.py index 6afb873..144b49d 100644 --- a/chimere/main/models.py +++ b/chimere/main/models.py @@ -20,7 +20,7 @@ """ Models description """ -import os, string +import os, string, json import lxml.etree as ElementTree from datetime import datetime, timedelta from subprocess import Popen, PIPE @@ -295,13 +295,13 @@ class Marker(models.Model): for cat in self.categories.all(): if categories_id and cat.id not in categories_id: continue - items = {'id':self.id, 'name':self.name, + items = {'id':self.id, 'name':json.dumps(self.name), 'geometry':self.point.geojson, 'icon_path':cat.icon.image, 'icon_width':cat.icon.image.width, 'icon_height':cat.icon.image.height,} jsons.append(u'{"type":"Feature", "geometry":%(geometry)s, '\ - u'"properties":{"pk": %(id)d, "name": "%(name)s", '\ + u'"properties":{"pk": %(id)d, "name": %(name)s, '\ u'"icon_path":"%(icon_path)s", "icon_width":%(icon_width)d, '\ u'"icon_height":%(icon_height)d}}' % items) return ",".join(jsons) @@ -425,10 +425,10 @@ class Route(models.Model): ''' if '#' not in color: color = '#' + color - attributes = {'id':self.id, 'name':self.name, + attributes = {'id':self.id, 'name':json.dumps(self.name), 'color':color, 'geometry':self.route.geojson,} return u'{"type":"Feature", "geometry":%(geometry)s, '\ - u'"properties":{"pk": %(id)d, "name": "%(name)s", '\ + u'"properties":{"pk": %(id)d, "name": %(name)s, '\ u'"color":"%(color)s"}}' % attributes def getTinyUrl(self): |