def sell(): global items global current_user global sellers_search_items items = read_data("items") current_user = read_data("current_user") sellers_search_items = [] seller_item_ids = get_value(current_user, 'items_list') seller_items = [] get_items_by_id("items", items, seller_item_ids, seller_items) if request.method == 'POST': search("sellers_search_items", sellers_search_items, items) return jsonify(sellers_search_items=sellers_search_items) else: return render_template('sell.html', current_user=current_user, items=items, sellers_search_items=sellers_search_items)
def buy(): global items global current_user global users global buyers_search_items if request.method == 'POST': search(buyers_search_items) return jsonify(buyers_search_items=buyers_search_items) else: return render_template('buy.html', items=items, current_user=current_user, users=users, buyers_search_items=buyers_search_items)
def tools(): global items global current_user global users global buyers_search_items items = read_data("items") users = read_data("users") current_user = read_data("current_user") household_items = [] furniture_items = [] electronics_items = [] appliances_items = [] tools_items = [] get_items_by_category(items, 'household', household_items) get_items_by_category(items, 'furniture', furniture_items) get_items_by_category(items, 'electronics', electronics_items) get_items_by_category(items, 'appliances', appliances_items) get_items_by_category(items, 'tools', tools_items) if request.method == 'POST': buyers_search_items = [] search("buyers_search_items", buyers_search_items, tools_items) return jsonify(buyers_search_items=buyers_search_items) else: return render_template('tools.html', items=items, current_user=current_user, users=users, buyers_search_items=buyers_search_items, household_items=household_items, furniture_items=furniture_items, electronics_items=electronics_items, appliances_items=appliances_items, tools_items=tools_items)