          a = create_a('restrict')
          a.restrict.p = P.objects.create()
          a.restrict.save()
          msg = (
              "Cannot delete some instances of model 'R' because they are "
              "referenced through a restricted foreign key: 'A.restrict'."
          )
          with self.assertRaisesMessage(RestrictedError, msg):
              a.restrict.p.delete()
          # Object referenced also with CASCADE relationship can be deleted.
          a.cascade.p = a.restrict.p
 
</s> remove             "referenced through a restricted foreign key: 'A.restrict'."
 </s> add             "referenced through restricted foreign keys: 'A.restrict'."
        )
        with self.assertRaisesMessage(RestrictedError, msg):
            a.restrict.delete()

    def test_restrict_multiple(self):
        a = create_a('restrict')
        B3.objects.create(restrict=a.restrict)
        msg = (
            "Cannot delete some instances of model 'R' because they are "
            "referenced through restricted foreign keys: 'A.restrict', "
            "'B3.restrict'." </s> remove             "referenced through a restricted foreign key: 'DeleteBottom.b1'."
 </s> add             "referenced through restricted foreign keys: 'DeleteBottom.b1'." </s> remove             "are referenced through a restricted foreign key: "
 </s> add             "are referenced through restricted foreign keys: " </s> remove             for model, fields in self.restricted_objects.items():
                for field, objs in fields.items():
                    for obj in objs:
                        raise RestrictedError(
                            "Cannot delete some instances of model '%s' "
                            "because they are referenced through a restricted "
                            "foreign key: '%s.%s'." % (
                                field.remote_field.model.__name__,
                                obj.__class__.__name__,
                                field.name,
                            ),
                            objs,
                        )
 </s> add             if self.restricted_objects.values():
                restricted_objects = defaultdict(list)
                for related_model, fields in self.restricted_objects.items():
                    for field, objs in fields.items():
                        if objs:
                            key = "'%s.%s'" % (related_model.__name__, field.name)
                            restricted_objects[key] += objs
                if restricted_objects:
                    raise RestrictedError(
                        'Cannot delete some instances of model %r because '
                        'they are referenced through restricted foreign keys: '
                        '%s.' % (
                            model.__name__,
                            ', '.join(restricted_objects),
                        ),
                        chain.from_iterable(restricted_objects.values()),
                    )
            "Cannot delete some instances of model 'P' because they are "
            "referenced through restricted foreign keys: 'A.restrict'."
          a = create_a('restrict')
          a.restrict.p = P.objects.create()
          a.restrict.save()
          msg = (
            "Cannot delete some instances of model 'P' because they are "
            "referenced through restricted foreign keys: 'A.restrict'."
            "Cannot delete some instances of model 'P' because they are "
            "referenced through restricted foreign keys: 'A.restrict'."
          )
          with self.assertRaisesMessage(RestrictedError, msg):
              a.restrict.p.delete()
          # Object referenced also with CASCADE relationship can be deleted.
          a.cascade.p = a.restrict.p
keep keep keep keep replace replace keep keep keep keep keep
 Refs #27852 -- Fixed object deletion to show all restricted related objects rather than just the first one. 
tests/delete/tests.py