def edit_product(product_id): if request.method == 'GET': product = Product.get_product(product_id) return render_template('product/edit_product.html', product=product) else: product = request.form['product'] url = request.form['url'] image_url = request.form['image-url'] introduction = request.form['introduction'] Product.edit_product(product_id, product, url, image_url, introduction) return redirect(url_for('single_product', product_id=product_id))
def edit_product(product_id): if request.method == 'GET': product = Product.get_product(product_id) return render_template('edit_product.html', product=product) elif request.method == 'POST': product = request.form['product'] url = request.form['url'] image_url = request.form['image-url'] introduction = request.form['introduction'] Product.edit_product(product_id, product, url, image_url, introduction) return redirect(url_for('single_product', product_id=product_id))
def single_product(product_id): product = Product.get_product(product_id) product['Introduction'] = markdown2.markdown(product['Introduction']) return render_template('single_product.html', product=product)
def single_product(product_id): product = Product.get_product(product_id) return render_template('single_product.html', product=product)
def single_product(product_id): product = Product.get_product(product_id) if not product: abort(404) product['Introduction'] = markdown2.markdown(product['Introduction']) return render_template('product/single_product.html', product=product)