def construct_change_message(form, formsets, add):
 change_message = []
 if add:
  change_message.append({'added': {}})
 elif form.changed_data:
  change_message.append({'changed': {'fields': form.changed_data}})
 if formsets:
  with translation_override(None):
   for formset in formsets:
    for added_object in formset.new_objects:
     change_message.append({'added': {'name': force_text(added_object._meta.verbose_name), 'object': force_text(added_object)}})
    for (changed_object, changed_fields) in formset.changed_objects:
     change_message.append({'changed': {'name': force_text(changed_object._meta.verbose_name), 'object': force_text(changed_object), 'fields': changed_fields}})
    for deleted_object in formset.deleted_objects:
     change_message.append({'deleted': {'name': force_text(deleted_object._meta.verbose_name), 'object': force_text(deleted_object)}})
 return change_message

def construct_change_message ( form , formsets , add ) : change_message = [ ] if add : change_message . append ( { 'added' : { } } ) elif form . changed_data : change_message . append ( { 'changed' : { 'fields' : form . changed_data } } ) if formsets : with translation_override ( None ) : for formset in formsets : for added_object in formset . new_objects : change_message . append ( { 'added' : { 'name' : force_text ( added_object . _meta . verbose_name ) , 'object' : force_text ( added_object ) } } ) for ( changed_object , changed_fields ) in formset . changed_objects : change_message . append ( { 'changed' : { 'name' : force_text ( changed_object . _meta . verbose_name ) , 'object' : force_text ( changed_object ) , 'fields' : changed_fields } } ) for deleted_object in formset . deleted_objects : change_message . append ( { 'deleted' : { 'name' : force_text ( deleted_object . _meta . verbose_name ) , 'object' : force_text ( deleted_object ) } } ) return change_message
construct a json structure describing changes from a changed object .