def link_load(request, from_node, to_node): start = request.GET.get('start', None) end = request.GET.get('end', None) links = Links.objects.filter( local_ifce__node__name=from_node, remote_ifce__node__name=to_node ) ifces = create_links_dict(links) if start and end: result = get_load_for_links(ifces, start, end) else: result = get_load_for_links(ifces) return HttpResponse(json.dumps(result), content_type='application/json')
def load(request): start = request.GET.get('start', None) end = request.GET.get('end', None) result = cache.get('load_%s_%s' % (start, end)) if not result: links = Links.objects.exclude(remote_ifce_id=0).select_related( 'local_ifce', 'remote_ifce', 'remote_ifce__node', 'local_ifce__node' ) ifces = create_links_dict(links) if start and end: result = get_load_for_links(ifces, start, end) else: result = get_load_for_links(ifces) result = json.dumps(result) cache.set('load_%s_%s' % (start, end), result) return HttpResponse(result, content_type='application/json')