def editRecord(self): values = dict() for i, edit in enumerate(self.edits): values[edit.field] = self.getValue(edit) if self.values[len(self.values) - 1]['name'] == 'state': values['state'] = self.values[len(self.values) - 1]['value'] appInst.update(self.table, self.keys, values) appInst.updateTableViews() self.close()
def editRecord(self): try: values = dict() for i, edit in enumerate(self.edits): values[edit.field] = self.getValue(edit) appInst.update(self.table, self.keys, values) appInst.updateTableViews() self.close() except IntegrityError: showMessage('Error', 'The same record already exists')