0001-maps-keep-the-marker-s-colour-property-58072.patch
combo/apps/maps/models.py | ||
---|---|---|
252 | 252 |
else: |
253 | 253 |
features = data |
254 | 254 | |
255 |
properties = [] |
|
256 | 255 |
if self.properties: |
257 |
properties = [x.strip() for x in self.properties.split(',')] |
|
256 |
property_names = [x.strip() for x in self.properties.split(',')] |
|
257 |
properties = features['properties'] |
|
258 | 258 |
for feature in features: |
259 | 259 |
if 'display_fields' in feature['properties']: |
260 | 260 |
# w.c.s. content, filter fields on varnames |
261 | 261 |
feature['properties']['display_fields'] = [ |
262 |
x for x in feature['properties']['display_fields'] if x.get('varname') in properties |
|
262 |
x |
|
263 |
for x in feature['properties']['display_fields'] |
|
264 |
if x.get('varname') in property_names |
|
263 | 265 |
] |
264 | 266 |
else: |
265 | 267 |
# classic geojson, filter properties |
266 | 268 |
feature['properties'] = dict( |
267 |
[x for x in feature['properties'].items() if x[0] in properties]
|
|
269 |
[x for x in feature['properties'].items() if x[0] in property_names]
|
|
268 | 270 |
) |
271 |
# keep the property for marker's colour |
|
272 |
if self.marker_colour and not self.marker_colour.startswith('#'): |
|
273 |
first_dotted_name = self.marker_colour.split('.')[0] |
|
274 |
if first_dotted_name in features['properties']: |
|
275 |
features['properties'] = properties[first_dotted_name] |
|
269 | 276 | |
270 | 277 |
if request and not self.geojson_accepts_circle_param and distance_params: |
271 | 278 |
geod = pyproj.Geod(ellps='WGS84') |
272 |
- |