notes, tracing issue
import json
from geonode.contrib.datatables.views_dataverse import *
# Lat/Lng layer
lat_lng_pk = 31
l = Layer.objects.get(pk=lat_lng_pk)
d = get_layer_and_join_metadata(l)
print json.dumps(d, indent=4)
d['layer_link'] # "layer_link": "/data/geonode:starbucks_u_x6",
# Shapefile
shp_pk = 25
l = Layer.objects.get(pk=shp_pk)
d = get_layer_and_join_metadata(l)
print json.dumps(d, indent=4)
d['layer_link'] # "layer_link": "http://localhost:8000/data/geonode:transport_f8t",ll = LatLngTableMappingRecord.objects.get(pk=4)
ll.as_json()
'''{'datatable': u'starbucks_u_x6',
'datatable_id': 25,
'lat_attribute': {'attribute': u'latitude', 'type': u'float'},
'lat_lng_record_id': 4,
'layer_id': 31,
'layer_link': u'/data/geonode:starbucks_u_x6',
'layer_name': u'starbucks_u_x6',
'layer_typename': u'geonode:starbucks_u_x6',
'lng_attribute': {'attribute': u'longitude', 'type': u'float'},
'mapped_record_count': 6444,
'unmapped_record_count': 0}
'''- LatLngTableMappingRecord ->
as_json()
data_dict['layer_link'] = self.layer.get_absolute_url()
- Fix is to remove line above b/c it's overwriting the existing layer_link in the dict that already as the server name--and is used by the TableJoin records