Beispiel #1
0
   def GET(self):
    	products = model.get_products()
        return render.index(products)


        productos = model.get_productos()
        return render.index(productos)    
Beispiel #2
0
def products():

    if request.method == 'POST':
        product_info = {}
        product_info['name'] = request.form['name']
        product_info['info'] = request.form['info']
        product_info['price'] = int(request.form['price'])
        product_info['seller'] = session['username']

        if bool(check_product(product_info['name'])) is True:
            return "Product already exists!"

        add_product_to_db(product_info)
        return redirect(url_for('home'))

    products = get_products()
    return render_template('products.html', products=products)
Beispiel #3
0
def products():

    if request.method == 'POST':
        product_info = {}

        product_info['name'] = request.form['name']
        product_info['info'] = request.form['info']
        product_info['price'] = request.form['price']
        product_info['seller'] = session['username']

        if bool(check_product(product_info['name'])) is True:
            return "product already exists"

        add_product_to_db(product_info)
        return redirect(url_for('products'))
    # return redirect(url_for('home'))


# @app.route('/show_products',methods=['GET'])
# def show_products():
    products = get_products()
    return render_template('products.html', products=products)
Beispiel #4
0
def getprod():
    products = get_products()
    return render_template("products.html", products=products)