diff options
Diffstat (limited to 'chimere/models.py')
| -rw-r--r-- | chimere/models.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/chimere/models.py b/chimere/models.py index 20c598e..c11a115 100644 --- a/chimere/models.py +++ b/chimere/models.py @@ -206,6 +206,8 @@ class SubCategory(models.Model): name = models.CharField(_(u"Name"), max_length=150) available = models.BooleanField(_(u"Available")) icon = models.ForeignKey(Icon, verbose_name=_(u"Icon")) + hover_icon = models.ForeignKey(Icon, verbose_name=_(u"Hover icon"), + blank=True, null=True, related_name='subcat_hovered') color_theme = models.ForeignKey(ColorTheme, verbose_name=_(u"Color theme"), blank=True, null=True) order = models.IntegerField(_(u"Order"), default=1000) @@ -519,12 +521,18 @@ class Marker(GeographicItem): items = {'id':self.id, 'name':json.dumps(self.name), 'geometry':self.point.geojson, 'icon_path':cat.icon.image, + 'icon_hover_path':cat.hover_icon.image \ + if cat.hover_icon else '', 'icon_width':cat.icon.image.width, - 'icon_height':cat.icon.image.height,} + 'icon_height':cat.icon.image.height, + 'category_name':json.dumps(cat.name)} jsons.append(u'{"type":"Feature", "geometry":%(geometry)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) + u'"icon_path":"%(icon_path)s", '\ + u'"icon_hover_path":"%(icon_hover_path)s", '\ + u'"icon_width":%(icon_width)d, '\ + u'"icon_height":%(icon_height)d, '\ + u'"category_name":%(category_name)s}}' % items) return ",".join(jsons) @property |
