@permission_required("core.manage_shop")
@require_POST
def delete_shipping_method(request, shipping_method_id):
    """Deletes shipping method with passed shipping id.

    All customers, which have selected this shipping method are getting the
    default shipping method.
    """
    try:
        shipping_method = ShippingMethod.objects.get(pk=shipping_method_id)
    except __HOLE__:
        pass
    else:
        for customer in Customer.objects.filter(selected_shipping_method=shipping_method_id):
            customer.selected_shipping_method = shipping_utils.get_default_shipping_method(request)
            customer.save()

        shipping_method.delete()

    return lfs.core.utils.set_message_cookie(
        url=reverse("lfs_manage_shipping"),
        msg=_(u"Shipping method has been deleted."),
    )
dataset/ETHPy150Open diefenbach/django-lfs/lfs/manage/shipping_methods/views.py/delete_shipping_method