public
Last active

  • Download Gist
foo.diff
Diff
1 2 3 4 5 6 7 8 9 10 11 12 13
diff --git a/django/db/models/fields/related.py b/django/db/models/fields/related.py
index 6299b20..577f503 100644
--- a/django/db/models/fields/related.py
+++ b/django/db/models/fields/related.py
@@ -268,7 +268,7 @@ class ReverseSingleRelatedObjectDescriptor(six.with_metaclass(RenameRelatedObjec
rel_obj_attr = self.field.get_foreign_related_value
instance_attr = self.field.get_local_related_value
instances_dict = dict((instance_attr(inst), inst) for inst in instances)
- query = {'%s__in' % self.field.related_query_name(): instances}
+ query = {'%s__in' % self.field.related_field.name: set([instance_attr(i)[0] for i in instances])}
qs = self.get_queryset(instance=instances[0]).filter(**query)
# Since we're going to assign directly in the cache,
# we must manage the reverse relation cache manually.

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.