(self, request, form, formsets)
return change_message or _('No fields changed.')
Construct a change message from a changed object
Construct a change message from a changed object
Construct a change message from a changed object
def construct_change_message(self, request, form, formsets):
        """ Construct a change message from a changed object """
        change_message = []
        if form.changed_data:
            change_message.append(
                _('Changed {0}.'.format(
                    get_text_list(form.changed_data, _('and')))))

        if formsets:
            for formset in formsets:
                for added_object in formset.new_objects:
                    change_message.append(
                        _('Added {0} "{1}".'.format(
                            force_str(added_object._meta.verbose_name),
                            force_str(added_object))))
                for changed_object, changed_fields in formset.changed_objects:
                    change_message.append(
                        _('Changed {0} for {1} "{2}".'.format(
                            get_text_list(changed_fields, _('and')),
                            force_str(changed_object._meta.verbose_name),
                            force_str(changed_object))))
                for deleted_object in formset.deleted_objects:
                    change_message.append(
                        _('Deleted {0} "{1}".'.format(
                            force_str(deleted_object._meta.verbose_name),
                            force_str(deleted_object))))

        change_message = ' '.join(change_message)
        return change_message or _('No fields changed.')
def construct_change_message ( self , request , form , formsets ) : change_message = [ ] if form . changed_data : change_message . append ( _ ( 'Changed {0}.' . format ( get_text_list ( form . changed_data , _ ( 'and' ) ) ) ) ) if formsets : for formset in formsets : for added_object in formset . new_objects : change_message . append ( _ ( 'Added {0} "{1}".' . format ( force_str ( added_object . _meta . verbose_name ) , force_str ( added_object ) ) ) ) for changed_object , changed_fields in formset . changed_objects : change_message . append ( _ ( 'Changed {0} for {1} "{2}".' . format ( get_text_list ( changed_fields , _ ( 'and' ) ) , force_str ( changed_object . _meta . verbose_name ) , force_str ( changed_object ) ) ) ) for deleted_object in formset . deleted_objects : change_message . append ( _ ( 'Deleted {0} "{1}".' . format ( force_str ( deleted_object . _meta . verbose_name ) , force_str ( deleted_object ) ) ) ) change_message = ' ' . join ( change_message ) return change_message or _ ( 'No fields changed.' )