Skip to main content

construct_change_message

Construct a JSON structure describing changes from a changed object. Translations are deactivated so that strings are stored untranslated. Translation happens later on LogEntry access.

def construct_change_message(
form: django.forms.ModelForm,
formsets: list,
add: bool
) - > list

Construct a JSON structure describing changes from a changed object. Translations are deactivated so that strings are stored untranslated. Translation happens later on LogEntry access.

Parameters

NameTypeDescription
formdjango.forms.ModelFormThe main form instance containing the changed data for the primary object.
formsetslistA collection of formsets representing related objects that may have been added, modified, or deleted.
addboolA flag indicating whether the primary object is being created for the first time.

Returns

TypeDescription
listA list of dictionaries representing the additions, changes, and deletions made to the object and its related formsets.