示例#1
0
文件: views.py 项目: icedstitch/crits
def campaigns_listing(request, option=None):
    """
    Generate Campaign Listing template.

    :param request: Django request object (Required)
    :type request: :class:`django.http.HttpRequest`
    :param option: Whether or not we should generate a CSV (yes if option is "csv")
    :type option: str
    :returns: :class:`django.http.HttpResponse`
    """

    if option == "csv":
        return generate_campaign_csv(request)
    return generate_campaign_jtable(request, option)
示例#2
0
def campaigns_listing(request, option=None):
    """
    Generate Campaign Listing template.

    :param request: Django request object (Required)
    :type request: :class:`django.http.HttpRequest`
    :param option: Whether or not we should generate a CSV (yes if option is "csv")
    :type option: str
    :returns: :class:`django.http.HttpResponse`
    """

    if option == "csv":
        return generate_campaign_csv(request)
    return generate_campaign_jtable(request, option)
示例#3
0
文件: views.py 项目: armtash/crits
def campaigns_listing(request, option=None):
    """
    Generate Campaign Listing template.

    :param request: Django request object (Required)
    :type request: :class:`django.http.HttpRequest`
    :param option: Whether or not we should generate a CSV (yes if option is "csv")
    :type option: str
    :returns: :class:`django.http.HttpResponse`
    """
    request.user._setup()
    user = request.user
    if user.has_access_to(CampaignACL.READ):
        if option == "csv":
            return generate_campaign_csv(request)
        return generate_campaign_jtable(request, option)

    else:
        return render(request, "error.html",
                                  {'error': 'User does not have permission to view Campaign listing.'})
示例#4
0
文件: views.py 项目: vsbca/crits
def campaigns_listing(request, option=None):
    """
    Generate Campaign Listing template.

    :param request: Django request object (Required)
    :type request: :class:`django.http.HttpRequest`
    :param option: Whether or not we should generate a CSV (yes if option is "csv")
    :type option: str
    :returns: :class:`django.http.HttpResponse`
    """
    request.user._setup()
    user = request.user
    if user.has_access_to(CampaignACL.READ):
        if option == "csv":
            return generate_campaign_csv(request)
        return generate_campaign_jtable(request, option)

    else:
        return render_to_response("error.html",
                                  {'error': 'User does not have permission to view Campaign listing.'},
                                  RequestContext(request))