

@require_objs_permissions_for_view(perm_names=['can_edit_aggregate'], permittee_func=get_user_from_req, target_func=get_leaf_queryset(Aggregate, 'agg_id'), methods=['GET', 'POST'])
def delete(request, agg_id):
    '\n    Display a confirmation page then stop all slices and delete the aggregate.\n    '
    next = (request.GET.get('next', None) or reverse('home'))
    aggregate = get_object_or_404(Aggregate, id=agg_id).as_leaf_class()
    if (request.method == 'POST'):
        for s in aggregate.slice_set.all():
            req.stop_slice(s)
    req = create_update.delete_object(request, model=aggregate.__class__, post_delete_redirect=next, object_id=agg_id, extra_context={
        'next': next,
    }, template_name=(TEMPLATE_PATH + '/delete.html'))
    if (req.status_code == HttpResponseRedirect.status_code):
        DatedMessage.objects.post_message_to_user(('Successfully deleted aggregate %s' % aggregate.name), request.user, msg_type=DatedMessage.TYPE_SUCCESS)
    return req

dataset/ETHPy150Open fp7-ofelia/ocf/expedient/src/python/expedient/clearinghouse/aggregate/views.py delete/VarMisuse@104/184 `aggregate`->`req`