def req_modify_commodity(request):
    if "username" in request.session:
        username = request.session['username']
    cid = request.GET['cid']
    commodity = mongodb_options.find_commodity_by_cid(db, cid)
    brands_list = mongodb_options.find_brands(db)
    classes_list = mongodb_options.find_classes(db)
    styles_list = mongodb_options.find_styles(db)
    sizes_list = mongodb_options.find_sizes(db)
    return render(request, 'manage_modify_commodity.html', {'login_user': username, 'flag': True, 'commodity': commodity, 'brands_list': brands_list, 'classes_list': classes_list, 'styles_list': styles_list, 'sizes_list': sizes_list})
def req_add_commodity(request):
    flag = False
    brands_list = mongodb_options.find_brands(db)
    classes_list = mongodb_options.find_classes(db)
    styles_list = mongodb_options.find_styles(db)
    sizes_list = mongodb_options.find_sizes(db)
    if "username" in request.session:
        username = request.session['username']
        flag = True
    if flag:
        return render(request, 'manage_add_commodity.html', {'login_user': username, 'flag': flag, 'brands_list': brands_list, 'classes_list': classes_list, 'styles_list': styles_list, 'sizes_list': sizes_list})
    else:
        return render(request, 'manage_index.html', {'message': '<script type="text/javascript">alert("对不起,您无法修改页面!");</script>'})
def req_size(request):
    if "username" in request.session:
        username = request.session['username']
    sizes_list = mongodb_options.find_sizes(db)
    return render(request, 'manage_size.html', {'login_user': username, 'flag': True, 'sizes_list': sizes_list})