Exemplo n.º 1
0
def query_condition_form(request, query, bread_crumb_trail, instance=None):

    form = QueryConditionForm(request.POST, instance=instance)

    if form.is_valid():
        query_condition = form.save()

        return HttpResponse(serializers.serialize(
            "json", [query_condition, query_condition.table]),
                            content_type='application/json')
    else:
        return HttpResponse(simplejson.dumps(["fail", form.errors]),
                            content_type='application/json')
Exemplo n.º 2
0
def query_condition_form(request, query,
                         bread_crumb_trail, instance=None):

    form = QueryConditionForm(request.POST, instance=instance)

    if form.is_valid():
        query_condition = form.save()

        return HttpResponse(
            serializers.serialize(
                "json", [query_condition, query_condition.table]),
            content_type='application/json')
    else:
        return HttpResponse(simplejson.dumps(["fail", form.errors]),
                            content_type='application/json')
Exemplo n.º 3
0
def query_detail(request, username, name):

    query = get_object_or_404(Query, owner__username=username, name=name)
    query_conditions = Query.serialize_conditions(
        query.querycondition_set.all())
    template = loader.get_template("lava_results_app/query_detail.html")
    return HttpResponse(
        template.render(
            {
                "query":
                query,
                "query_conditions":
                query_conditions,
                "bread_crumb_trail":
                BreadCrumbTrail.leading_to(
                    query_detail, username=username, name=name),
                "context_help": ["lava-queries-charts"],
                "condition_form":
                QueryConditionForm(instance=None,
                                   initial={
                                       "query": query,
                                       "table": query.content_type
                                   }),
            },
            request=request,
        ))
Exemplo n.º 4
0
def query_detail(request, username, name):

    query = get_object_or_404(Query, owner__username=username, name=name)
    query_conditions = Query.serialize_conditions(
        query.querycondition_set.all())
    template = loader.get_template('lava_results_app/query_detail.html')
    return HttpResponse(
        template.render(
            {
                'query':
                query,
                'query_conditions':
                query_conditions,
                'bread_crumb_trail':
                BreadCrumbTrail.leading_to(
                    query_detail, username=username, name=name),
                'context_help': ['lava-queries-charts'],
                'condition_form':
                QueryConditionForm(instance=None,
                                   initial={
                                       'query': query,
                                       'table': query.content_type
                                   }),
            },
            request=request))
Exemplo n.º 5
0
def query_detail(request, username, name):

    query = get_object_or_404(Query, owner__username=username, name=name)

    return render_to_response(
        'lava_results_app/query_detail.html', {
            'query': query,
            'bread_crumb_trail': BreadCrumbTrail.leading_to(
                query_detail, username=username, name=name),
            'context_help': BreadCrumbTrail.leading_to(query_list),
            'condition_form': QueryConditionForm(
                request.user, instance=None,
                initial={'query': query, 'table': query.content_type}),
        }, RequestContext(request)
    )