def end_edit_cell(self, event): print("cell edited") ORDERITEM.query.filter_by(**{ "iid": self.sheet.get_cell_data(event[0], 0) }).update( {headers[event[1]]: self.sheet.get_cell_data(event[0], event[1])}) db_session.commit()
def row_delete(self, event): print("row deleted") print(event) print({"pid": self.sheet.get_cell_data(event[1][0], 0)}) PRODUCT.query.filter_by(**{ "pid": self.sheet.get_cell_data(event[1][0], 0) }).delete() db_session.commit()
def new_order(): if len(temp_cid1.get()) > 0: cid1 = int(temp_cid1.get()) o = ORDER1(oDate=datetime.datetime.now(), cid=cid1) db_session.add(o) db_session.commit() root.destroy() main() else: pass
def end_insert_row(self, event): print("cell inserted") try: oi = ORDERITEM(**{'oid': self.oid}) db_session.add(oi) db_session.commit() self.sheet.set_cell_data(event[1], 1, value=self.oid) self.sheet.set_cell_data(event[1], 0, value=oi.iid) self.sheet.dehighlight_rows(rows=[event[0]]) except Exception as e: self.sheet.highlight_rows(rows=[event[0]], fg='red', bg='red') e.with_traceback()
def run_query_on_db(**kwargs): c = CUSTOMER(**kwargs) db_session.add(c) db_session.commit() print("Customer inserted.")
def run_query_on_db(**kwargs): p = PRODUCT(**kwargs) db_session.add(p) db_session.commit() print("Product inserted.")