I am trying to create a simple form to add and edit records from a table, one at a time in an SQLite database using model_view widgets and QSqlTableModel. There are two records in the table. When I run the script, the form appears but no data. I know I must be missing a line of code to select a record from the table to display but don't know how to do that. I'm trying to follow the pattern in Chapter 9 of Mastering GUI Programming with Python and adapt it to work with one record at a time.
I tried various lines of code trying to specify the id (primary key) of a record in the Recipe table. Nothing worked.