Esempio n. 1
0
	def handleProdotto(self, prodotto):
		p = Product()
		
		try:
			p.code = self.getText(prodotto.getElementsByTagName("CODART")[0].childNodes)
			p.name = self.getText(prodotto.getElementsByTagName("DESART")[0].childNodes)
			p.price = self.getText(prodotto.getElementsByTagName("PREZZO1")[0].childNodes).replace(',', '.')
		except(TypeError, IndexError):
			pass
		
		self.results.append(p)
Esempio n. 2
0
def save_product():
    product_id = request.form['product_id']

    product = Product.query.get(product_id)
    if product == None:
        product = Product()

    product.code = request.form['code']
    product.name = request.form['name']
    product.price = request.form['price']

    db.session.add(product)
    db.session.commit()
    flash('Salvataggio effettuato.', category='success')
    return redirect(url_for('.display_products'))
Esempio n. 3
0
def save_product():
	product_id = request.form['product_id']
	
	product = Product.query.get(product_id)
	if product == None:
		product = Product()
	
	product.code=request.form['code']
	product.name=request.form['name']
	product.price=request.form['price']
	
	db.session.add(product)
	db.session.commit()
	flash('Salvataggio effettuato.', category='success')
	return redirect(url_for('.display_products'))
Esempio n. 4
0
def new_product():
    product = Product()
    return render_template("product.htm", product=product)