Ticket #10157: 10157.diff

File 10157.diff, 920 bytes (added by David Gouldin, 16 years ago)
  • django/db/models/fields/related.py

     
    210210                                (value, instance._meta.object_name,
    211211                                 self.related.get_accessor_name(), self.related.opts.object_name))
    212212
    213         # Set the value of the related field
    214         setattr(value, self.related.field.rel.get_related_field().attname, instance)
     213        # Set the value of the related field to the value of the related object's related field
     214        setattr(value, self.related.field.attname, getattr(instance, self.related.field.rel.get_related_field().attname))
    215215
    216216        # Since we already know what the related object is, seed the related
    217217        # object caches now, too. This avoids another db hit if you get the
Back to Top