def initializeModel(model): model.setTable("employee") model.setEditStrategy(QtSql.QSqlTableModel.OnManualSubmit) model.setRelation(2, QtSql.QSqlRelation('city', 'id', 'name')) model.setRelation(3, QtSql.QSqlRelation('country', 'id', 'name')) model.setHeaderData(0, QtCore.Qt.Horizontal, "ID") model.setHeaderData(1, QtCore.Qt.Horizontal, "Name") model.setHeaderData(2, QtCore.Qt.Horizontal, "City") model.setHeaderData(3, QtCore.Qt.Horizontal, "Country") model.select()
def loanAdjustmentModel(): """Deprecated?""" model = loanAdjustmentModelnew() model.setEditStrategy(model.OnManualSubmit) model.setTable('loanadjustments') model.setRelation(0, QtSql.QSqlRelation('employees', 'empid', 'empname')) for i in range(model.columnCount()): model.setHeaderData(i, QtCore.Qt.Horizontal, Definitions.TableHeaders['loanadjustments'][i]) model.setFilter("amount > 0") model.select() return model