def orderpay_del(request):
    o_id=request.GET['o_id']
    client_mongodb_options.del_orders(db, str(o_id))
    flag = False
    if "login_user" in request.session:
        username = request.session['login_user']
        flag = True
    if flag:
        cart = client_mongodb_options.find_cart(db, username)
        if cart:
            c_num = cart['c_num']
        else:
            c_num = 0
        return render(request, 'client/client_orderpay_del.html',
                      {'username': username, 'flag': flag, 'c_num': c_num})
    else:
        return render(request, 'client/client_orderpay_del.html',{'flag': flag})
Esempio n. 2
0
def delete_items(request):
    del_object = request.POST['del_object']
    del_item_list_str = request.POST['del_item_list']
    del_item_list = del_item_list_str[1:].split(',')  # 获取到的del_item_list_str字符串开头多了1个逗号,所以此时需要分片
    if del_object == 'commodity':
        for item_id in del_item_list:
            mongodb_options.del_commodity(db, str(item_id))
    elif del_object == 'brand':
        for item_id in del_item_list:
            mongodb_options.del_brand(db, str(item_id))
    elif del_object == 'class':
        for item_id in del_item_list:
            mongodb_options.del_class(db, str(item_id))
    elif del_object == 'client':
        for item_id in del_item_list:
            mongodb_options.del_client(db, str(item_id))
    elif del_object == 'admin':
        for item_id in del_item_list:
            mongodb_options.del_admin(db, str(item_id))
    elif del_object == 'style':
        for item_id in del_item_list:
            mongodb_options.del_style(db, str(item_id))
    elif del_object == 'size':
        for item_id in del_item_list:
            mongodb_options.del_size(db, str(item_id))
    elif del_object == 'shop_addr':
        for item_id in del_item_list:
            mongodb_options.del_shop_addr(db, str(item_id))

    elif del_object == 'orders':
        for item_id in del_item_list:
            client_mongodb_options.del_orders(db, str(item_id))

    elif del_object == 'news':
        for item_id in del_item_list:
            mongodb_options.del_news(db, str(item_id))
    return HttpResponse("删除成功")