@permission_required("core.manage_shop")
@require_POST
def delete_delivery_time(request, id):
    # Remove the delivery time from all products delivery
    for product in Product.objects.filter(delivery_time=id):
        product.delivery_time = None
        product.save()

    # Remove the delivery time from all products order_time
    for product in Product.objects.filter(order_time=id):
        product.order_time = None
        product.save()

    delivery_time = get_object_or_404(DeliveryTime, pk=id)
    delivery_time.delete()

    return lfs.core.utils.set_message_cookie(
        url=reverse("lfs_manage_delivery_times"),
        msg=_(u"Delivery time has been deleted."),
    )
Deletes the delivery time with passed id.
dataset/ETHPy150Open diefenbach/django-lfs/lfs/manage/views/delivery_times.py/delete_delivery_time