def on_btnRemove_click(self):
        item = self.ui.tblitems.currentIndex()
        data = item.data(QtCore.Qt.ItemDataRole.UserRole)
        
        r = QMessageBox.question(self, "Подтверждение", "Точно ли хотите удалить запись?")
        if r == QMessageBox.StandardButton.No:
            return
        
        with Session(self.engine) as s:
            query = """
            DELETE 
            FROM dannie
            WHERE id = :id
            """
            
            s.execute(text(query), {"id": data.id})
            s.commit()
        self.load_diametr()
        self.load_dannie()
Вот мой код. Далее, при нажатии на кнопку def on_btnRemove_click вылезает ошибка:
AttributeError: 'NoneType' object has no attribute 'id
Пожалуйста, скажите, как мне привязать айдишник??