def hub_locations_json(request, slug): hub = get_object_or_404(Hub.active, slug__exact=slug) raw_user_list = get_users(hub) # Get events with location item_list = get_event_list(hub) hub_dict = get_location_dict(hub, 'community') if hub_dict: item_list += [hub_dict] item_list += get_user_list(raw_user_list) item_list += get_organization_list(raw_user_list) item_list += get_app_member_list(hub) return json_response(item_list, callback='map.render')
def location_list_json(request): """Returns the locations in JSON format""" object_list = Location.published.select_related('category').all() dict_list = [_get_location_data(l) for l in object_list] return json_response(dict_list, callback='map.render')
def testbed_locations_json(request, slug): testbed = get_object_or_404(Testbed.active, slug__exact=slug) item_list =[get_location_dict(testbed, 'testbed')] item_list += get_app_list(testbed) return json_response(item_list, callback='map.render')
def hub_locations_json(request, slug): hub = get_object_or_404(Hub.active, slug__exact=slug) # Get events with location event_list = get_event_list(hub) return json_response(event_list, callback='map.render')
def test_response_without_callback_is_valid(self): data = {'hello': 'world'} response = json_response(data) eq_(response.status_code, 200) eq_(response.content, u'{"hello": "world"}') eq_(response['Content-Type'], 'application/javascript')
for domain in domains: if domain['label'] not in domain_label: domain_label.append(domain['label']) feature_label = [] for feature in features: if feature['label'] not in feature_label: feature_label.append(feature['label']) for label in stage_label: new_stages.append(in_dictlist(('label', label), stages)) for label in domain_label: new_domains.append(in_dictlist(('label', label), domains)) for label in feature_label: new_features.append(in_dictlist(('label', label), features)) get_status = { 'domain': new_domains, 'total': apps.get('total') + acs.get('total'), 'feature': new_features, 'stage': new_stages } context = { 'apps': get_status } return json_response(context, callback='chart.render')