@require_objs_permissions_for_view(
    perm_names=["can_add_aggregate"],
    permittee_func=get_user_from_req,
    target_func=get_queryset_from_class(Aggregate),
    methods=["POST"])
def list(request, agg_id=None):
    '''
    Get a list of aggregates. agg_id specifies id to highlight. On POST,
    get the type of aggregate to be created and redirect to that model's
    create url.
    '''
    
    qs = Aggregate.objects.all().order_by('name')
    
    if request.method == "GET":
        form = AggregateTypeForm()
    elif request.method == "POST":
        form = AggregateTypeForm(request.POST)
        if form.is_valid():
            model = form.cleaned_data["type"].model_class()
            return HttpResponseRedirect(model.get_create_url())
    else:
        return HttpResponseNotAllowed("GET", "POST")
    
    return list_detail.object_list(
        request,
        queryset=qs,
        template_name=TEMPLATE_PATH%"/list.html",
        template_object_name="aggregate",
        extra_context={
            'form': form,
            'highlight_id': agg_id,
        },
    )
dataset/ETHPy150Open fp7-ofelia/ocf/expedient/src/python/expedient/clearinghouse/aggregate/views.py/list/operator `+` -> `%`