0001-datasource-prefix-additional-keys-by-properties_-499.patch
tests/admin_pages/test_datasource.py | ||
---|---|---|
230 | 230 |
assert 'Preview' in resp.text |
231 | 231 |
assert 'foo' in resp.text |
232 | 232 |
assert 'bar' in resp.text |
233 |
assert 'Additional keys are available: label' in resp.text |
|
233 |
assert 'Additional keys are available: geometry_coordinates, geometry_type, properties_label' in resp.text
|
|
234 | 234 | |
235 | 235 |
data_source.data_source = {'type': 'formula', 'value': '[str(x) for x in range(100)]'} |
236 | 236 |
data_source.store() |
wcs/admin/data_sources.py | ||
---|---|---|
252 | 252 |
r += htmltext('<li><tt>%s</tt>: %s</li>') % ( |
253 | 253 |
item.get('id'), item.get('text')) |
254 | 254 |
if data_source.get('type') == 'geojson': |
255 |
additional_keys |= set(item.get('properties', {}).keys()) |
|
255 |
additional_keys.add('geometry_coordinates') |
|
256 |
additional_keys.add('geometry_type') |
|
257 |
additional_keys |= set('properties_%s' % k for k in item.get('properties', {}).keys()) |
|
256 | 258 |
else: |
257 | 259 |
additional_keys |= set(item.keys()) |
258 | 260 |
if len(items) > 10: |
259 | 261 |
r += htmltext('<li>...</li>') |
260 | 262 |
r += htmltext('</ul>') |
261 |
additional_keys -= set(['id', 'text']) |
|
263 |
additional_keys -= set(['id', 'text', 'properties_id', 'properties_text'])
|
|
262 | 264 |
if additional_keys: |
263 | 265 |
r += htmltext('<p>%s %s</p>') % (_('Additional keys are available:'), |
264 | 266 |
', '.join(sorted(additional_keys))) |
265 |
- |