Ticket #10157: 10157_2.diff
File 10157_2.diff, 1.3 KB (added by , 16 years ago) |
---|
-
django/db/models/fields/related.py
210 210 (value, instance._meta.object_name, 211 211 self.related.get_accessor_name(), self.related.opts.object_name)) 212 212 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)) 215 215 216 216 # Since we already know what the related object is, seed the related 217 217 # object caches now, too. This avoids another db hit if you get the -
tests/modeltests/one_to_one/models.py
79 79 <Restaurant: Ace Hardware the restaurant> 80 80 >>> r.place 81 81 <Place: Ace Hardware the place> 82 >>> p2.id 83 2 82 84 83 85 # Set the place back again, using assignment in the reverse direction. 84 86 >>> p1.restaurant = r