diff options
Diffstat (limited to 'chimere/models.py')
| -rw-r--r-- | chimere/models.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/chimere/models.py b/chimere/models.py index ed84124..8446a68 100644 --- a/chimere/models.py +++ b/chimere/models.py @@ -624,10 +624,23 @@ class Marker(GeographicItem): val = values[unicode(propertymodel.id)] self.setProperty(propertymodel, val) + PROPERTIES_KEYS = ['point', 'pk', 'name', 'weight'] + @classmethod + def _getJson(cls, values, base_dct={"properties":{}}): + item = base_dct.copy() + item["geometry"] = {"type": "Point", + "coordinates": [values['point'].x, + values['point'].y]} + item["properties"]['pk'] = values['pk'] + item["properties"]['name'] = values['name'] + if values['weight']: + item["properties"]['weight'] = values['weight'] + return item + def _getItems(self, base_dct={"properties":{}}): '''Return a dict representation for json ''' - item = base_dct + item = base_dct.copy() item["geometry"] = {"type": "Point", "coordinates": [ self.point.x, self.point.y ] } |
