You might be interested in the way things work on the inside of Auditlog. This section covers the internal APIs of Auditlog which is very useful when you are looking for more advanced ways to use the application or if you like to contribute to the project.

The documentation below is automatically generated from the source code.

Models and fields


Signal receivers

Calculating changes

auditlog.diff.get_field_value(obj, field)[source]

Gets the value of a given model instance field. :param obj: The model instance. :type obj: Model :param field: The field you want to find the value of. :type field: Any :return: The value of the field as a string. :rtype: str


Returns the list of fields in the given model instance. Checks whether to use the official _meta API or use the raw data. This method excludes many to many fields.

Parameters:instance (Model) – The model instance to get the fields for
Returns:The list of fields for the given model (instance)
Return type:list
auditlog.diff.model_instance_diff(old, new)[source]

Calculates the differences between two model instances. One of the instances may be None (i.e., a newly created model or deleted model). This will cause all fields with a value to have changed (from None).

  • old (Model) – The old state of the model instance.
  • new (Model) – The new state of the model instance.

A dictionary with the names of the changed fields as keys and a two tuple of the old and new field values as value.

Return type:



Returns whether the given field should be tracked by Auditlog.

Untracked fields are many-to-many relations and relations to the Auditlog LogEntry model.

Parameters:field (Field) – The field to check.
Returns:Whether the given field should be tracked.
Return type:bool