Ticket #14876: 14876.diff

File 14876.diff, 1.4 KB (added by Tomek Paczkowski, 13 years ago)
  • django/db/models/sql/query.py

    diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
    index 99663b6..783aef1 100644
    a b class Query(object):  
    11011101                table = table_it.next()
    11021102                if join == table and self.alias_refcount[join] > 1:
    11031103                    continue
    1104                 join_promote = self.promote_alias(join)
     1104                join_promote = self.promote_alias(join, unconditional=True)
    11051105                if table != join:
    11061106                    table_promote = self.promote_alias(table)
    11071107                break
  • tests/regressiontests/queries/tests.py

    diff --git a/tests/regressiontests/queries/tests.py b/tests/regressiontests/queries/tests.py
    index 31856ba..a4586de 100644
    a b class Queries4Tests(BaseQuerysetTest):  
    979979        Report.objects.create(name='r2', creator=a3)
    980980        Report.objects.create(name='r3')
    981981
     982    def test_ticket14876(self):
     983        q1 = Report.objects.filter(Q(creator__isnull=True) | Q(creator__extra__info='e1'))
     984        q2 = Report.objects.filter(Q(creator__isnull=True)) | Report.objects.filter(Q(creator__extra__info='e1'))
     985        ident = lambda x: x
     986        self.assertQuerysetEqual(q1, list(q2), ident)
     987
    982988    def test_ticket7095(self):
    983989        # Updates that are filtered on the model being updated are somewhat
    984990        # tricky in MySQL. This exercises that case.
Back to Top