Ticket #17527: 17527.patch

File 17527.patch, 710 bytes (added by guettli, 3 years ago)
  • django/db/models/fields/related.py

     
    474474            def add(self, *objs):
    475475                for obj in objs:
    476476                    if not isinstance(obj, self.model):
    477                         raise TypeError("'%s' instance expected" % self.model._meta.object_name)
     477                        raise TypeError("'%s' instance expected, got %r" % (self.model._meta.object_name, obj))
    478478                    setattr(obj, rel_field.name, self.instance)
    479479                    obj.save()
    480480            add.alters_data = True
Back to Top