mirror of
https://github.com/django/django.git
synced 2025-06-03 10:39:12 +00:00
Fix exception message from 3190abcd. Refs #18153.
Thanks Preston Holmes.
This commit is contained in:
parent
3190abcd75
commit
0a0fe8f71d
@ -308,7 +308,7 @@ class SingleRelatedObjectDescriptor(object):
|
|||||||
related_pk = getattr(instance, self.related.field.rel.get_related_field().attname)
|
related_pk = getattr(instance, self.related.field.rel.get_related_field().attname)
|
||||||
if related_pk is None:
|
if related_pk is None:
|
||||||
raise ValueError('Cannot assign "%r": "%s" instance isn\'t saved in the database.' %
|
raise ValueError('Cannot assign "%r": "%s" instance isn\'t saved in the database.' %
|
||||||
(value, self.related.opts.object_name))
|
(value, instance._meta.object_name))
|
||||||
|
|
||||||
# Set the value of the related field to the value of the related object's related field
|
# Set the value of the related field to the value of the related object's related field
|
||||||
setattr(value, self.related.field.attname, related_pk)
|
setattr(value, self.related.field.attname, related_pk)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user