anfema_django_utils.db.mixins.ChangedFieldValuesModelMixin

class ChangedFieldValuesModelMixin

Bases: anfema_django_utils.db.mixins.ChangedFieldValuesMixinBase

Mixin to keep track of changed field values.

All changes (since loading the model from the database) are available in the changed_field_values property. The property contains a mapping where the key is the changed field name and the value a tuple of the old and new field value.

To just check if a field was changed use the in operator: >>> ‘field_name’ in self.changed_field_values

Methods

from_db(db, field_names, values)

rtype:

Model

Attributes

classmethod from_db(db, field_names, values)
Return type:

Model