def products(): if request.method == 'POST': product_info = {} product_info['name'] = request.form['name'] product_info['price'] = int(request.form['price']) product_info['description'] = request.form['description'] product_info['quantity'] = int(request.form['quantity']) product_info['seller'] = session['username'] if product_exists(product_info['name']): return "product exists" add_product(product_info) return redirect(url_for('products')) products = products_list() return render_template('products.html', products=products)
def seller(): if request.method == 'POST': product_info = {} product_info['name'] = request.form['name'] product_info['price'] = int(request.form['price']) product_info['seller'] = session['username'] product_info['description'] = request.form['description'] if product_exists(product_info['name']) is False: add_product(product_info) return redirect(url_for('product')) return "product already exists. Go back and enter another product"
def products(): if request.method == 'POST': product_info = {} #import pdb;pdb.set_trace() product_info['name'] = request.form['name'] product_info['price'] = int(request.form['price']) product_info['description'] = request.form['description'] product_info['seller'] = session['username'] if product_exists(product_info['name']): return "product exists" add_product(product_info) #return "product added! check your db" return redirect(url_for("home")) return render_template('ran.html', products=product_list())