

def _get_objects(self, show=None, order_by=None, name=None, func_name=None, silk_request=None, filters=None):
    if (not filters):
        filters = []
    if (not show):
        show = self.default_show
    manager = Profile.objects
    if silk_request:
        query_set = manager.filter(request=silk_request)
    else:
        query_set = manager.all()
    if (not order_by):
        order_by = self.defualt_order_by
    if (order_by == 'Recent'):
        query_set = query_set.order_by('-start_time')
    elif (order_by == 'Name'):
        query_set = query_set.order_by('-name')
    elif (order_by == 'Function Name'):
        query_set = query_set.order_by('-func_name')
    elif (order_by == 'Num. Queries'):
        query_set = query_set.annotate(num_queries=Count('queries')).order_by('-num_queries')
    elif (order_by == 'Time'):
        query_set = query_set.order_by('-time_taken')
    elif (order_by == 'Time on queries'):
        query_set = query_set.annotate(db_time=Sum('queries__time_taken')).order_by('-db_time')
    elif order_by:
        raise RuntimeError(('Unknown order_by: "%s"' % order_by))
    if func_name:
        query_set = query_set.filter(func_name=func_name)
    if name:
        query_set = query_set.filter(name=name)
    for f in filters:
        query_set = f.contribute_to_query_set(query_set)
        query_set = query_set.filter(f)
    return list(query_set[:show])

dataset/ETHPy150Open django-silk/silk/silk/views/profiling.py ProfilingView._get_objects/original