def change_plan_page_count(request):
    """
    Return total number of pages according to page size, which must be
    specified as query parameter.
    """
    user = request.user
    user_change_plans = ChangePlan.objects.filter(owner=user)
    return get_page_count_response(
        ChangePlan, request.query_params, premade_object_query=user_change_plans
    )
예제 #2
0
def log_page_count(request):
    """
    Return total number of pages according to page size, which must be
    specified as query parameter.
    """
    return get_page_count_response(
        Log,
        request.query_params,
        data_for_filters=request.data,
    )
예제 #3
0
def offline_storage_site_page_count(request):
    """
    Return total number of pages according to page size, which must be
    specified as query parameter.
    """
    offline_storage_sites = Site.get_offline_storage_sites()
    return get_page_count_response(
        Site,
        request.query_params,
        data_for_filters=request.data,
        premade_object_query=offline_storage_sites,
    )
예제 #4
0
def datacenter_page_count(request):
    """
    Return total number of pages according to page size, which must be
    specified as query parameter.
    """
    datacenters = Site.get_datacenters()
    return get_page_count_response(
        Site,
        request.query_params,
        data_for_filters=request.data,
        premade_object_query=datacenters,
    )
def decommissioned_asset_page_count(request):
    """
    Return total number of pages according to page size, which must be
    specified as query parameter.
    """
    (change_plan, failure_response) = get_change_plan(
        request.query_params.get("change_plan"))
    if failure_response:
        return failure_response
    if change_plan:
        return get_page_count_response_for_cp(request,
                                              change_plan,
                                              decommissioned=True)
    else:
        return get_page_count_response(
            DecommissionedAsset,
            request.query_params,
            data_for_filters=request.data,
        )
예제 #6
0
def offline_storage_asset_page_count(request):
    """
    Return total number of pages according to page size, which must be
    specified as query parameter.
    """
    (change_plan, failure_response) = get_change_plan(
        request.query_params.get("change_plan")
    )
    if failure_response:
        return failure_response
    if change_plan:
        return get_page_count_response_for_cp(request, change_plan, stored=True)
    else:
        stored_assets = assets_offline_queryset()
        return get_page_count_response(
            Asset,
            request.query_params,
            data_for_filters=request.data,
            premade_object_query=stored_assets,
        )
예제 #7
0
def user_page_count(request):
    """
    Return total number of pages according to page size, which must be
    specified as query parameter.
    """
    return get_page_count_response(User, request.query_params)