|
|
@@ -283,32 +283,7 @@ class Collection(models.Model):
|
|
|
props['collection']['enabled'] = True
|
|
|
if 'leafletmap' not in props['collection']['template']:
|
|
|
props['collection']['template']['leafletmap'] = {'latitudeField': None, 'longitudeField': None, 'labelField': None}
|
|
|
- if 'showGrid' not in props['collection']['template']:
|
|
|
- props['collection']['template']['showGrid'] = True
|
|
|
- if 'showChart' not in props['collection']['template']:
|
|
|
- props['collection']['template']['showChart'] = False
|
|
|
- if 'chartSettings' not in props['collection']['template']:
|
|
|
- props['collection']['template']['chartSettings'] = {}
|
|
|
- if 'chartType' not in props['collection']['template']['chartSettings']:
|
|
|
- props['collection']['template']['chartSettings']['chartType'] = 'bars'
|
|
|
- if 'chartSorting' not in props['collection']['template']['chartSettings']:
|
|
|
- props['collection']['template']['chartSettings']['chartSorting'] = 'none'
|
|
|
- if 'chartScatterGroup' not in props['collection']['template']['chartSettings']:
|
|
|
- props['collection']['template']['chartSettings']['chartScatterGroup'] = None
|
|
|
- if 'chartScatterSize' not in props['collection']['template']['chartSettings']:
|
|
|
- props['collection']['template']['chartSettings']['chartScatterSize'] = None
|
|
|
- if 'chartScope' not in props['collection']['template']['chartSettings']:
|
|
|
- props['collection']['template']['chartSettings']['chartScope'] = 'world'
|
|
|
- if 'chartX' not in props['collection']['template']['chartSettings']:
|
|
|
- props['collection']['template']['chartSettings']['chartX'] = None
|
|
|
- if 'chartYSingle' not in props['collection']['template']['chartSettings']:
|
|
|
- props['collection']['template']['chartSettings']['chartYSingle'] = None
|
|
|
- if 'chartYMulti' not in props['collection']['template']['chartSettings']:
|
|
|
- props['collection']['template']['chartSettings']['chartYMulti'] = []
|
|
|
- if 'chartData' not in props['collection']['template']['chartSettings']:
|
|
|
- props['collection']['template']['chartSettings']['chartData'] = []
|
|
|
- if 'chartMapLabel' not in props['collection']['template']['chartSettings']:
|
|
|
- props['collection']['template']['chartSettings']['chartMapLabel'] = None
|
|
|
+
|
|
|
for facet in props['collection']['facets']:
|
|
|
properties = facet['properties']
|
|
|
if 'gap' in properties and not 'initial_gap' in properties:
|
|
|
@@ -356,20 +331,6 @@ class Collection(models.Model):
|
|
|
</div>""" % ' '.join(['{{%s}}' % field['name'] for field in fields]),
|
|
|
"isGridLayout": True,
|
|
|
"showFieldList": True,
|
|
|
- "showGrid": True,
|
|
|
- "showChart": False,
|
|
|
- "chartSettings": {
|
|
|
- 'chartType': 'bars',
|
|
|
- 'chartSorting': 'none',
|
|
|
- 'chartScatterGroup': None,
|
|
|
- 'chartScatterSize': None,
|
|
|
- 'chartScope': 'world',
|
|
|
- 'chartX': None,
|
|
|
- 'chartYSingle': None,
|
|
|
- 'chartYMulti': [],
|
|
|
- 'chartData': [],
|
|
|
- 'chartMapLabel': None,
|
|
|
- },
|
|
|
"fieldsAttributes": [self._make_gridlayout_header_field(field) for field in fields],
|
|
|
"fieldsSelected": [],
|
|
|
"leafletmap": {'latitudeField': None, 'longitudeField': None, 'labelField': None},
|
|
|
@@ -395,7 +356,6 @@ class Collection(models.Model):
|
|
|
|
|
|
@classmethod
|
|
|
def _make_gridlayout_header_field(cls, field, isDynamic=False):
|
|
|
- print field
|
|
|
return {'name': field['name'], 'sort': {'direction': None}, 'isDynamic': isDynamic}
|
|
|
|
|
|
def get_absolute_url(self):
|
|
|
@@ -422,32 +382,6 @@ class Collection(models.Model):
|
|
|
if 'collection' in properties_python:
|
|
|
if 'showFieldList' not in properties_python['collection']['template']:
|
|
|
properties_python['collection']['template']['showFieldList'] = True
|
|
|
- if 'showGrid' not in properties_python['collection']['template']:
|
|
|
- properties_python['collection']['template']['showGrid'] = True
|
|
|
- if 'showChart' not in properties_python['collection']['template']:
|
|
|
- properties_python['collection']['template']['showChart'] = False
|
|
|
- if 'chartSettings' not in properties_python['collection']['template']:
|
|
|
- properties_python['collection']['template']['chartSettings'] = {}
|
|
|
- if 'chartType' not in properties_python['collection']['template']['chartSettings']:
|
|
|
- properties_python['collection']['template']['chartSettings']['chartType'] = 'bars'
|
|
|
- if 'chartSorting' not in properties_python['collection']['template']['chartSettings']:
|
|
|
- properties_python['collection']['template']['chartSettings']['chartSorting'] = 'none'
|
|
|
- if 'chartScatterGroup' not in properties_python['collection']['template']['chartSettings']:
|
|
|
- properties_python['collection']['template']['chartSettings']['chartScatterGroup'] = None
|
|
|
- if 'chartScatterSize' not in properties_python['collection']['template']['chartSettings']:
|
|
|
- properties_python['collection']['template']['chartSettings']['chartScatterSize'] = None
|
|
|
- if 'chartScope' not in properties_python['collection']['template']['chartSettings']:
|
|
|
- properties_python['collection']['template']['chartSettings']['chartScope'] = 'world'
|
|
|
- if 'chartX' not in properties_python['collection']['template']['chartSettings']:
|
|
|
- properties_python['collection']['template']['chartSettings']['chartX'] = None
|
|
|
- if 'chartYSingle' not in properties_python['collection']['template']['chartSettings']:
|
|
|
- properties_python['collection']['template']['chartSettings']['chartYSingle'] = None
|
|
|
- if 'chartYMulti' not in properties_python['collection']['template']['chartSettings']:
|
|
|
- properties_python['collection']['template']['chartSettings']['chartYMulti'] = []
|
|
|
- if 'chartData' not in properties_python['collection']['template']['chartSettings']:
|
|
|
- properties_python['collection']['template']['chartSettings']['chartData'] = []
|
|
|
- if 'chartMapLabel' not in properties_python['collection']['template']['chartSettings']:
|
|
|
- properties_python['collection']['template']['chartSettings']['chartMapLabel'] = None
|
|
|
|
|
|
return properties_python
|
|
|
|
|
|
@@ -540,27 +474,18 @@ class Collection2(object):
|
|
|
if 'showChart' not in props['collection']['template']:
|
|
|
props['collection']['template']['showChart'] = False
|
|
|
if 'chartSettings' not in props['collection']['template']:
|
|
|
- props['collection']['template']['chartSettings'] = {}
|
|
|
- if 'chartType' not in props['collection']['template']['chartSettings']:
|
|
|
- props['collection']['template']['chartSettings']['chartType'] = 'bars'
|
|
|
- if 'chartSorting' not in props['collection']['template']['chartSettings']:
|
|
|
- props['collection']['template']['chartSettings']['chartSorting'] = 'none'
|
|
|
- if 'chartScatterGroup' not in props['collection']['template']['chartSettings']:
|
|
|
- props['collection']['template']['chartSettings']['chartScatterGroup'] = None
|
|
|
- if 'chartScatterSize' not in props['collection']['template']['chartSettings']:
|
|
|
- props['collection']['template']['chartSettings']['chartScatterSize'] = None
|
|
|
- if 'chartScope' not in props['collection']['template']['chartSettings']:
|
|
|
- props['collection']['template']['chartSettings']['chartScope'] = 'world'
|
|
|
- if 'chartX' not in props['collection']['template']['chartSettings']:
|
|
|
- props['collection']['template']['chartSettings']['chartX'] = None
|
|
|
- if 'chartYSingle' not in props['collection']['template']['chartSettings']:
|
|
|
- props['collection']['template']['chartSettings']['chartYSingle'] = None
|
|
|
- if 'chartYMulti' not in props['collection']['template']['chartSettings']:
|
|
|
- props['collection']['template']['chartSettings']['chartYMulti'] = []
|
|
|
- if 'chartData' not in props['collection']['template']['chartSettings']:
|
|
|
- props['collection']['template']['chartSettings']['chartData'] = []
|
|
|
- if 'chartMapLabel' not in props['collection']['template']['chartSettings']:
|
|
|
- props['collection']['template']['chartSettings']['chartMapLabel'] = None
|
|
|
+ props['collection']['template']['chartSettings'] = {
|
|
|
+ 'chartType': 'bars',
|
|
|
+ 'chartSorting': 'none',
|
|
|
+ 'chartScatterGroup': None,
|
|
|
+ 'chartScatterSize': None,
|
|
|
+ 'chartScope': 'world',
|
|
|
+ 'chartX': None,
|
|
|
+ 'chartYSingle': None,
|
|
|
+ 'chartYMulti': [],
|
|
|
+ 'chartData': [],
|
|
|
+ 'chartMapLabel': None,
|
|
|
+ }
|
|
|
if 'enabled' not in props['collection']:
|
|
|
props['collection']['enabled'] = True
|
|
|
if 'leafletmap' not in props['collection']['template']:
|