@csrf_exempt
def data_json(request):
 json_data = []
 for resource in ResourceBase.objects.all():
  record = {}
  record['title'] = resource.title
  record['description'] = resource.abstract
  record['keyword'] = resource.keyword_csv.split(',')
  record['modified'] = resource.csw_insert_date.isoformat()
  record['publisher'] = resource.poc.organization
  record['contactPoint'] = resource.poc.name_long
  record['mbox'] = resource.poc.email
  record['identifier'] = resource.uuid
  if resource.is_published:
   record['accessLevel'] = 'public'
  else:
   record['accessLevel'] = 'non-public'
  record['distribution'] = []
  for link in resource.link_set.all():
   record['distribution'].append({'accessURL': link.url, 'format': link.mime})
  json_data.append(record)
 return HttpResponse(json.dumps(json_data), 'application/json')

@ csrf_exempt def data_json ( request ) : json_data = [ ] for resource in ResourceBase . objects . all ( ) : record = { } record [ 'title' ] = resource . title record [ 'description' ] = resource . abstract record [ 'keyword' ] = resource . keyword_csv . split ( ',' ) record [ 'modified' ] = resource . csw_insert_date . isoformat ( ) record [ 'publisher' ] = resource . poc . organization record [ 'contactPoint' ] = resource . poc . name_long record [ 'mbox' ] = resource . poc . email record [ 'identifier' ] = resource . uuid if resource . is_published : record [ 'accessLevel' ] = 'public' else : record [ 'accessLevel' ] = 'non-public' record [ 'distribution' ] = [ ] for link in resource . link_set . all ( ) : record [ 'distribution' ] . append ( { 'accessURL' : link . url , 'format' : link . mime } ) json_data . append ( record ) return HttpResponse ( json . dumps ( json_data ) , 'application/json' )
return data .