Fix exception message from 3190abcd. Refs .

Thanks Preston Holmes.
This commit is contained in:
Aymeric Augustin 2012-10-09 22:06:55 +02:00
parent 3190abcd75
commit 0a0fe8f71d
1 changed files with 1 additions and 1 deletions
django/db/models/fields

View File

@ -308,7 +308,7 @@ class SingleRelatedObjectDescriptor(object):
related_pk = getattr(instance, self.related.field.rel.get_related_field().attname)
if related_pk is None:
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
setattr(value, self.related.field.attname, related_pk)