예제 #1
0
def bundle_stream_list(request):
    """
    List of bundle streams.
    """
    data = BundleStreamView(request,
                            model=BundleStream,
                            table_class=BundleStreamTable)
    table = BundleStreamTable(data.get_table_data())
    context_dict = {
        'bread_crumb_trail':
        BreadCrumbTrail.leading_to(bundle_stream_list),
        "bundle_stream_table":
        table,
        "terms_data":
        table.prepare_terms_data(data),
        "search_data":
        table.prepare_search_data(data),
        "discrete_data":
        table.prepare_discrete_data(data),
        'has_personal_streams':
        (request.user.is_authenticated()
         and BundleStream.objects.filter(user=request.user).exists()),
        'has_team_streams':
        (request.user.is_authenticated() and BundleStream.objects.filter(
            group__in=request.user.groups.all()).exists()),
    }
    RequestConfig(request, paginate={
        "per_page": table.length
    }).configure(table)
    template = get_template('dashboard_app/bundle_stream_list.html')
    return HttpResponse(template.render(context_dict, request))
예제 #2
0
def bundle_stream_list(request):
    """
    List of bundle streams.
    """
    data = BundleStreamView(request, model=BundleStream, table_class=BundleStreamTable)
    table = BundleStreamTable(data.get_table_data())
    context_dict = {
        'bread_crumb_trail': BreadCrumbTrail.leading_to(bundle_stream_list),
        "bundle_stream_table": table,
        "terms_data": table.prepare_terms_data(data),
        "search_data": table.prepare_search_data(data),
        "discrete_data": table.prepare_discrete_data(data),
        'has_personal_streams': (
            request.user.is_authenticated() and
            BundleStream.objects.filter(user=request.user).count() > 0),
        'has_team_streams': (
            request.user.is_authenticated() and
            BundleStream.objects.filter(
                group__in=request.user.groups.all()).count() > 0),
    }
    RequestConfig(request, paginate={"per_page": table.length}).configure(table)
    if django.VERSION > (1, 8):
        template = get_template('dashboard_app/bundle_stream_list.html')
        return HttpResponse(template.render(context_dict, request))
    else:
        return render_to_response(
            'dashboard_app/bundle_stream_list.html', context_dict, RequestContext(request)
        )
예제 #3
0
def mybundlestreams(request):
    data = MyBundleStreamView(request, model=BundleStream, table_class=BundleStreamTable)
    table = BundleStreamTable(data.get_table_data())
    RequestConfig(request, paginate={"per_page": table.length}).configure(table)
    template = get_template("dashboard_app/mybundlestreams.html")
    return HttpResponse(template.render(
        {
            'bread_crumb_trail': BreadCrumbTrail.leading_to(mybundlestreams),
            "bundle_stream_table": table,
            "terms_data": table.prepare_terms_data(data),
            "search_data": table.prepare_search_data(data),
            "discrete_data": table.prepare_discrete_data(data),
        },
        request=request))
def mybundlestreams(request):
    data = MyBundleStreamView(request, model=BundleStream, table_class=BundleStreamTable)
    table = BundleStreamTable(data.get_table_data())
    RequestConfig(request, paginate={"per_page": table.length}).configure(table)
    return render_to_response(
        "dashboard_app/mybundlestreams.html",
        {
            'bread_crumb_trail': BreadCrumbTrail.leading_to(mybundlestreams),
            "bundle_stream_table": table,
            "terms_data": table.prepare_terms_data(data),
            "search_data": table.prepare_search_data(data),
            "discrete_data": table.prepare_discrete_data(data),
        },
        RequestContext(request))