def image_report_list(request):

    group_tables = {}
    terms_data = search_data = discrete_data = {}
    for group in ImageReportGroup.objects.all():
        if group.imagereport_set.count():
            prefix = "group_%s_" % group.id
            group_view = GroupImageReportView(request, group, model=ImageReportChart, table_class=GroupImageReportTable)
            table = GroupImageReportTable(group_view.get_table_data(prefix), prefix=prefix)
            search_data.update(table.prepare_search_data(group_view))
            discrete_data.update(table.prepare_discrete_data(group_view))
            terms_data.update(table.prepare_terms_data(group_view))
            group_tables[group.name] = table
            config = RequestConfig(request, paginate={"per_page": table.length})
            config.configure(table)

    prefix = "other_"
    other_view = OtherImageReportView(request, model=ImageReportChart, table_class=OtherImageReportTable)
    other_image_table = OtherImageReportTable(other_view.get_table_data(prefix), prefix=prefix)
    config = RequestConfig(request, paginate={"per_page": other_image_table.length})
    config.configure(other_image_table)
    search_data.update(other_image_table.prepare_search_data(other_view))
    discrete_data.update(other_image_table.prepare_discrete_data(other_view))
    terms_data.update(other_image_table.prepare_terms_data(other_view))

    if request.user.is_authenticated():
        prefix = "user_"
        view = UserImageReportView(request, model=ImageReportChart, table_class=UserImageReportTable)
        user_image_table = UserImageReportTable(view.get_table_data(prefix), prefix=prefix)
        config = RequestConfig(request, paginate={"per_page": user_image_table.length})
        config.configure(user_image_table)
        search_data.update(user_image_table.prepare_search_data(view))
        discrete_data.update(user_image_table.prepare_discrete_data(view))
        terms_data.update(user_image_table.prepare_terms_data(view))
    else:
        user_image_table = None

    return render_to_response(
        'dashboard_app/image_report_list.html', {
            'user_image_table': user_image_table,
            'other_image_table': other_image_table,
            'search_data': search_data,
            "discrete_data": discrete_data,
            'terms_data': terms_data,
            'group_tables': group_tables,
            'bread_crumb_trail': BreadCrumbTrail.leading_to(image_report_list),
            'context_help': BreadCrumbTrail.leading_to(image_report_list),
        }, RequestContext(request)
    )
Beispiel #2
0
def image_report_list(request):

    group_tables = {}
    terms_data = search_data = discrete_data = {}
    for group in ImageReportGroup.objects.all().prefetch_related("imagereport_set"):
        if group.imagereport_set.exists():
            prefix = "group_%s_" % group.id
            group_view = GroupImageReportView(request, group, model=ImageReportChart, table_class=GroupImageReportTable)
            table = GroupImageReportTable(group_view.get_table_data(prefix), prefix=prefix)
            search_data.update(table.prepare_search_data(group_view))
            discrete_data.update(table.prepare_discrete_data(group_view))
            terms_data.update(table.prepare_terms_data(group_view))
            group_tables[group.name] = table
            config = RequestConfig(request, paginate={"per_page": table.length})
            config.configure(table)

    prefix = "other_"
    other_view = OtherImageReportView(request, model=ImageReportChart, table_class=OtherImageReportTable)
    other_image_table = OtherImageReportTable(other_view.get_table_data(prefix), prefix=prefix)
    config = RequestConfig(request, paginate={"per_page": other_image_table.length})
    config.configure(other_image_table)
    search_data.update(other_image_table.prepare_search_data(other_view))
    discrete_data.update(other_image_table.prepare_discrete_data(other_view))
    terms_data.update(other_image_table.prepare_terms_data(other_view))

    if request.user.is_authenticated():
        prefix = "user_"
        view = UserImageReportView(request, model=ImageReportChart, table_class=UserImageReportTable)
        user_image_table = UserImageReportTable(view.get_table_data(prefix), prefix=prefix)
        config = RequestConfig(request, paginate={"per_page": user_image_table.length})
        config.configure(user_image_table)
        search_data.update(user_image_table.prepare_search_data(view))
        discrete_data.update(user_image_table.prepare_discrete_data(view))
        terms_data.update(user_image_table.prepare_terms_data(view))
    else:
        user_image_table = None
    template = loader.get_template('dashboard_app/image_report_list.html')
    return HttpResponse(template.render(
        {
            'user_image_table': user_image_table,
            'other_image_table': other_image_table,
            'search_data': search_data,
            "discrete_data": discrete_data,
            'terms_data': terms_data,
            'group_tables': group_tables,
            'bread_crumb_trail': BreadCrumbTrail.leading_to(image_report_list),
            'context_help': BreadCrumbTrail.leading_to(image_report_list),
        }, request=request)
    )
Beispiel #3
0
def my_subscriptions(request):

    prefix = "filter_"
    filter_view = SubscribedFiltersView(request, model=TestRunFilter,
                                        table_class=PublicFiltersTable)
    filters_table = PublicFiltersTable(
        request.user,
        filter_view.get_table_data(prefix),
        prefix=prefix
    )
    config = RequestConfig(request)
    config.configure(filters_table)

    search_data = filters_table.prepare_search_data(filter_view)
    discrete_data = filters_table.prepare_discrete_data(filter_view)
    terms_data = filters_table.prepare_terms_data(filter_view)
    times_data = filters_table.prepare_times_data(filter_view)

    prefix = "report_"
    report_view = SubscribedImageReportView(request, model=ImageReportChart,
                                            table_class=UserImageReportTable)
    report_table = UserImageReportTable(report_view.get_table_data(prefix),
                                        prefix=prefix)
    config = RequestConfig(request)
    config.configure(report_table)

    search_data.update(report_table.prepare_search_data(report_view))
    discrete_data.update(report_table.prepare_discrete_data(report_view))
    terms_data.update(report_table.prepare_terms_data(report_view))
    times_data.update(report_table.prepare_times_data(report_view))
    template = get_template('dashboard_app/subscribed_list.html')
    return HttpResponse(template.render(
        {
            'filters_table': filters_table,
            'report_table': report_table,
            "terms_data": terms_data,
            "search_data": search_data,
            "times_data": times_data,
            "discrete_data": discrete_data,
            'bread_crumb_trail': BreadCrumbTrail.leading_to(
                my_subscriptions),
        }, request=request)
    )
Beispiel #4
0
def my_subscriptions(request):

    prefix = "filter_"
    filter_view = SubscribedFiltersView(request,
                                        model=TestRunFilter,
                                        table_class=PublicFiltersTable)
    filters_table = PublicFiltersTable(request.user,
                                       filter_view.get_table_data(prefix),
                                       prefix=prefix)
    config = RequestConfig(request)
    config.configure(filters_table)

    search_data = filters_table.prepare_search_data(filter_view)
    discrete_data = filters_table.prepare_discrete_data(filter_view)
    terms_data = filters_table.prepare_terms_data(filter_view)
    times_data = filters_table.prepare_times_data(filter_view)

    prefix = "report_"
    report_view = SubscribedImageReportView(request,
                                            model=ImageReportChart,
                                            table_class=UserImageReportTable)
    report_table = UserImageReportTable(report_view.get_table_data(prefix),
                                        prefix=prefix)
    config = RequestConfig(request)
    config.configure(report_table)

    search_data.update(report_table.prepare_search_data(report_view))
    discrete_data.update(report_table.prepare_discrete_data(report_view))
    terms_data.update(report_table.prepare_terms_data(report_view))
    times_data.update(report_table.prepare_times_data(report_view))
    template = get_template('dashboard_app/subscribed_list.html')
    return HttpResponse(
        template.render(
            {
                'filters_table': filters_table,
                'report_table': report_table,
                "terms_data": terms_data,
                "search_data": search_data,
                "times_data": times_data,
                "discrete_data": discrete_data,
                'bread_crumb_trail':
                BreadCrumbTrail.leading_to(my_subscriptions),
            },
            request=request))