Example #1
0
def download(request, format="png", view="", show="", minimized="", related=""):
    '''
        Regenera el gráfico y lo devuelve según el formato que recibe como parámetro.
    '''
    if format not in Utils.CONTENT_TYPES:
        return HttpResponseNotFound("Content type '%s' not supported" % format)
    
    show = Utils.split(show, "_")
    program = None
    if view == 'completo':
        g = RawGraphViz(show, Utils.split(minimized, "_"), Utils.split(related, "_"), extra={'layout': 'fdp'}).graph()
    else:
        g = Utils.plantUML(show)
        program = 'fdp'
            
    return HttpResponse(g.create(program, format=format), content_type=Utils.CONTENT_TYPES[format])
Example #2
0
def filter(request, format="", view="", show="", minimized="", related=""):
    req = request.REQUEST
    if request.method == 'GET':
        ctx = Utils.context(format, view, show, minimized, related)
        ctx.update(csrf(request))
        
        if view == 'completo':
            g = RawGraphViz(Utils.split(show, '_'), Utils.split(minimized, '_'), Utils.split(related, '_'), extra={'layout': 'fdp', 'size': '10'}).graph()
            request.session['program'] = None
        else:
            g = Utils.plantUML(Utils.split(show, '_'))
            request.session['program'] = 'fdp'

        ctx['cmap'] = g.create(format='cmapx') if g is not None else None
        request.session['graph'] = g.to_string() if g is not None else None

        return render_to_response('filter.html', ctx)
    else:
        return HttpResponseRedirect(reverse(filter, kwargs=Utils.request_to_context(req)))