I have a form.SchemaForm that uses an interface containing a DataGridField.

Here is a sample of my interface that contains the DataGridField: class IAsset(form.Schema): """

    Calibrations = schema.List(title=u"Calibrations",
                               value_type=DictRow(title=u"Calibrations",
                                                  schema=ICalibration
                                                 )
                              )

Here is a sample of the interface that the DataGridField uses.

class ICalibration(form.Schema):
    """Interface for calibration record
    """
    Calibration_ID = schema.Int(title=u"Calibration ID",
                                required=True)
    ...

I have an Asset class and a Calibration class, both of which are tied to a backend database. Each Calibration record is tied to an Asset.

Currently my solution is to iterate through each row listed in the DataGridField and determine if the record in the list is in the Calibrations table of the database, adding a new record if its not and updating a record if it is. This seems obvious to me that this is an inefficient solution. So, is it possible to determine which rows in the DataGridField were added and which ones were changed?

0

There are 0 answers