Exemplo n.º 1
0
def index(request, format='gif',template_name="mapper/index.html"):

    
    graph = pgv.AGraph(strict=False,directed=True)
    graph.graph_attr['label'] = 'Entire Map'
    graph.node_attr['shape'] = 'box'
    
    edges = []
    
    for app in Application.objects.all():
        
        graph = make_node(graph, app)    
        slug_app_title = slugify(app.title)  
        
        for loop_app in app.pulling():

            graph = make_node(graph, loop_app)        
            app_title = slugify(loop_app.title)
            graph.add_edge(app_title, slug_app_title)            

        for loop_app in app.pushing():
            
            graph = make_node(graph, loop_app)        
            app_title = slugify(loop_app.title)            
            graph.add_edge(slug_app_title, app_title)
    
    image = create_graph(graph.string(), format)
    
    return HttpResponse(image, mimetype="image/%s" % format)
Exemplo n.º 2
0
def application(request, application_id, format):
    
    application = get_app(application_id)
    slug_app_title = slugify(application.title)     

    graph = pgv.AGraph(strict=False,directed=True)
    graph.graph_attr['label'] = 'Map for %s' % str(application.title)
    graph.node_attr['shape'] = 'box'

    graph = make_node(graph, application)
    
    for app in application.pulling():

        graph = make_node(graph, app)        
        graph.add_edge(slugify(app.title), slug_app_title)        

    for app in application.pushing():
        graph = make_node(graph, app)        
        graph.add_edge(slug_app_title, slugify(app.title))

    image = create_graph(graph.string(), format)
    
    return HttpResponse(image, mimetype="image/%s" % format)