def ajax_update_category_groups(request): if request.method == "GET": site_id = request.GET["site_id"] category_groups_src = request.GET["category_groups_src"] connection = mongo_client.connection is_succ, msg = updateCategoryGroups(connection, site_id, category_groups_src) result = {"is_succ": is_succ, "msg": msg} return HttpResponse(json.dumps(result))
def ajax_update_category_groups2(request): user_name = request.session.get("user_name", None) api_key = request.GET.get("api_key", None) _checkUserAccessSite(user_name, api_key) connection = mongo_client.connection c_sites = connection["tjb-db"]["sites"] site = c_sites.find_one({"api_key": api_key}) category_groups_src = request.GET.get("category_groups_src", "") is_succ, msg = updateCategoryGroups(connection, site["site_id"], category_groups_src) result = {"is_succ": is_succ, "msg": msg} return HttpResponse(json.dumps(result))
def ajax_update_category_groups2(request): user_name = request.session.get("user_name", None) api_key = request.GET.get("api_key", None) _checkUserAccessSite(user_name, api_key) connection = mongo_client.connection c_sites = connection["tjb-db"]["sites"] site = c_sites.find_one({"api_key": api_key}) category_groups_src = request.GET.get("category_groups_src", ''); is_succ, msg = updateCategoryGroups(connection, site['site_id'], category_groups_src) result = {"is_succ": is_succ, "msg": msg} return HttpResponse(json.dumps(result))