Example #1
0
def query(request, query_hash):
    query = Query.objects.get(hash=query_hash)

    stacks = Stack.objects.filter(query=query)
    stacks = stacks.order_by('-total_cost')
    stacks = list(stacks)

    sample = Sample.objects.filter(stack=stacks[0])[0]

    extra = ""
    for addon in get_view_addons(query.query_type):
        extra += addon(query, stacks)

    query_types = _get_query_types()

    return render_to_response('djangosampler/query.html', 
            locals(),
            context_instance=RequestContext(request))
Example #2
0
def query(request, query_hash):
    query = Query.objects.get(hash=query_hash)

    stacks = Stack.objects.filter(query=query)
    stacks = stacks.order_by('-total_cost')
    stacks = list(stacks)

    sample = Sample.objects.filter(stack=stacks[0])[0]

    extra = ""
    for addon in get_view_addons(query.query_type):
        extra += addon(query, stacks)

    recent_queries = []
    start_date = query.created_dt.date()
    for day in xrange(-7, 7):
        recent_date = start_date + timedelta(days=day)
        recent_query_hash = query.get_hash_for_date(recent_date)
        try:
            recent_query = Query.objects.get(hash=recent_query_hash)
        except Query.DoesNotExist:
            recent_query = None
        recent_queries.append((recent_date, recent_query))


    date_string = query.created_dt.strftime('%Y-%m-%d')
    back_link = reverse('queries',
        kwargs={
            'date_string': date_string,
            'query_type': query.query_type, 
            'sort': 'total_duration', 
            'offset': 0
    })

    return render_to_response('djangosampler/query.html', 
            locals(),
            context_instance=RequestContext(request))