Ticket #18090: ticket_18090.diff

File ticket_18090.diff, 668 bytes (added by Luke Plant, 13 years ago)

fix

  • django/db/models/fields/related.py

    diff -r 0296323919a2 django/db/models/fields/related.py
    a b  
    239239    def get_prefetch_query_set(self, instances):
    240240        vals = set(instance._get_pk_val() for instance in instances)
    241241        params = {'%s__pk__in' % self.related.field.name: vals}
    242         return (self.get_query_set(instance=instances[0]),
     242        return (self.get_query_set(instance=instances[0]).filter(params),
    243243                attrgetter(self.related.field.attname),
    244244                lambda obj: obj._get_pk_val(),
    245245                True,
Back to Top