1 from manifold.core.query import Query, AnalyzedQuery
3 from django.views.generic.base import TemplateView
5 from unfold.loginrequired import LoginRequiredView
6 from django.http import HttpResponse
8 from manifold.core.query import Query, AnalyzedQuery
9 from manifoldapi.manifoldapi import execute_query
14 def dispatch(request, platform_name):
15 return get(request, platform_name)
17 def get(request, platform_name):
19 platform_query = Query().get('local:platform').filter_by('disabled', '==', '0').select('platform', 'platform_longname', 'platform_url', 'platform_description','gateway_type')
20 response = execute_query(request,platform_query)
22 q = Query.get('slice').select('slice_hrn')
23 result = execute_query(request,q)
26 # query = Query.get('local:object').select('table')
27 # results = execute_query(request, query)
30 query = Query.get('local:object').filter_by('table', '==', 'slice').select('column.name')
31 results = execute_query(request, query)
35 response_data['columns'] = [ 'platform', 'platform_longname', 'platform_url', 'platform_description','gateway_type' ]
36 response_data['labels'] = [ 'Platform', 'Name', 'Url', 'Description','Gateway Type' ]
37 response_data['data'] = []
38 #response_data['resources'] = { 'total' : len(r) }
40 response_data['data'].append([ r['platform'], r['platform_longname'], r['platform_url'], r['platform_description'], r['gateway_type'] ])
42 return HttpResponse(json.dumps(response_data), content_type="application/json")