def handleCliente(self, cliente): cl = Customer() cl.name = self.handleClienteRagSoc(cliente.getElementsByTagName("RAGSOC")[0]) cl.code = self.handleClienteCodCli(cliente.getElementsByTagName("CODCLI")[0]) try: cl.address = self.handleClienteIndir(cliente.getElementsByTagName("INDIR")[0]) except(TypeError, IndexError): cl.address = None try: cl.cap = self.handleClienteCap(cliente.getElementsByTagName("CAP")[0]) except(TypeError, IndexError): pass try: cl.city = self.handleClienteLocal(cliente.getElementsByTagName("LOCAL")[0]) except(TypeError, IndexError): pass try: cl.prov = self.handleClienteProv(cliente.getElementsByTagName("PROV")[0]) except(TypeError, IndexError): pass try: cl.part_iva = self.handleClientePartIva(cliente.getElementsByTagName("PARTIVA")[0]) except(TypeError, IndexError): pass self.results.append(cl)
def save_customer(): customer_id = request.form['customer_id'] customer = Customer.query.get(customer_id) if customer == None: customer = Customer() customer.code = request.form['code'] customer.name = request.form['name'] customer.address = request.form['address'] customer.cap = request.form['cap'] customer.city = request.form['city'] customer.prov = request.form['prov'] customer.part_iva = request.form['part_iva'] db.session.add(customer) db.session.commit() flash('Salvataggio effettuato.', category='success') return redirect(url_for('.display_customers'))
def save_customer(): customer_id = request.form['customer_id'] customer = Customer.query.get(customer_id) if customer == None: customer = Customer() customer.code=request.form['code'] customer.name=request.form['name'] customer.address=request.form['address'] customer.cap=request.form['cap'] customer.city=request.form['city'] customer.prov=request.form['prov'] customer.part_iva=request.form['part_iva'] db.session.add(customer) db.session.commit() flash('Salvataggio effettuato.', category='success') return redirect(url_for('.display_customers'))
def new_customer(): customer = Customer() return render_template("customer.htm", customer=customer)