def METHOD_NAME(request, project_id=None):
    project = None
    if request.method == 'POST':
        form_name = request.POST.get('form_name', '')
        if form_name == DeleteBundleForm.name:
            form = DeleteBundleForm(request.POST)
            if form.is_valid():
                bundle = get_object_or_404(
                    Bundle, id=form.cleaned_data['bundle_id']
                )
                bundle.delete()
    if project_id is None:
        bundles = request.user.bundles.all()
    else:
        project = get_object_or_404(Project, linkname=project_id)
        bundles = request.user.bundles.filter(project=project)
    for bundle in bundles:
        bundle.delete_form = DeleteBundleForm(
            auto_id=False, initial={'bundle_id': bundle.id}
        )
    context = {
        'bundles': bundles,
        'project': project,
    }
    return render(request, 'patchwork/bundles.html', context)