Modifying the record form for read and update
As long as we're editing views, we'll need to look at our DataRecordForm
view and adjust it to make it capable of updating records.
Take a moment and consider the following changes we'll need to make:
- The form will need some way to load in a record provided by the controller.
- The form will need to keep track of what record it's editing, or if it's a new record.
- Our user will need some visual indication of what record is being edited.
- Our
Save
button is currently in the application. It doesn't really make sense in any context other than the form, so it should probably be part of the form. - This means our form will need a callback to call when the save button is clicked. We'll need to provide it with a
callbacks
dictionary like we did with our other views.
Updating __init__()
Let's start working through these with our __init__()
method:
def __init__(self, parent, fields, settings, callbacks, *args, **kwargs): self.callbacks...