Ticket #12823: 12823_1.1.diff

File 12823_1.1.diff, 3.6 KB (added by PhiR_42, 14 years ago)

patch and test vs 1.1.2

  • Django-1.1.2//django/db/models/sql/query.py

    diff -ur orig/Django-1.1.2//django/db/models/sql/query.py Django-1.1.2//django/db/models/sql/query.py
    old new  
    19451945        query.bump_prefix()
    19461946        query.clear_ordering(True)
    19471947        query.set_start(prefix)
    1948         self.add_filter(('%s__in' % prefix, query), negate=True, trim=True,
     1948        new_prefix = prefix.split(LOOKUP_SEP)[0]               
     1949        self.add_filter(('%s__in' % new_prefix, query), negate=True, trim=True,
    19491950                can_reuse=can_reuse)
    19501951
    19511952        # If there's more than one join in the inner query (before any initial
  • Django-1.1.2//tests/regressiontests/queries/models.py

    diff -ur orig/Django-1.1.2//tests/regressiontests/queries/models.py Django-1.1.2//tests/regressiontests/queries/models.py
    old new  
    291291>>> t4 = Tag.objects.create(name='t4', parent=t3)
    292292>>> t5 = Tag.objects.create(name='t5', parent=t3)
    293293
    294 >>> n1 = Note.objects.create(note='n1', misc='foo')
    295 >>> n2 = Note.objects.create(note='n2', misc='bar')
    296 >>> n3 = Note.objects.create(note='n3', misc='foo')
     294>>> n1 = Note.objects.create(id=1, note='n1', misc='foo')
     295>>> n2 = Note.objects.create(id=2, note='n2', misc='bar')
     296>>> n3 = Note.objects.create(id=3, note='n3', misc='foo')
    297297
    298 >>> ann1 = Annotation.objects.create(name='a1', tag=t1)
     298>>> ann1 = Annotation.objects.create(id=10, name='a1', tag=t1)
    299299>>> ann1.notes.add(n1)
    300 >>> ann2 = Annotation.objects.create(name='a2', tag=t4)
     300>>> ann2 = Annotation.objects.create(id=11, name='a2', tag=t4)
    301301>>> ann2.notes.add(n2, n3)
    302302
    303303Create these out of order so that sorting by 'id' will be different to sorting
    304304by 'info'. Helps detect some problems later.
    305 >>> e2 = ExtraInfo.objects.create(info='e2', note=n2)
    306 >>> e1 = ExtraInfo.objects.create(info='e1', note=n1)
     305>>> e2 = ExtraInfo.objects.create(id=20, info='e2', note=n2)
     306>>> e1 = ExtraInfo.objects.create(id=21, info='e1', note=n1)
    307307
    308 >>> a1 = Author.objects.create(name='a1', num=1001, extra=e1)
    309 >>> a2 = Author.objects.create(name='a2', num=2002, extra=e1)
    310 >>> a3 = Author.objects.create(name='a3', num=3003, extra=e2)
    311 >>> a4 = Author.objects.create(name='a4', num=4004, extra=e2)
     308>>> a1 = Author.objects.create(id=31, name='a1', num=1001, extra=e1)
     309>>> a2 = Author.objects.create(id=32, name='a2', num=2002, extra=e1)
     310>>> a3 = Author.objects.create(id=33, name='a3', num=3003, extra=e2)
     311>>> a4 = Author.objects.create(id=34, name='a4', num=4004, extra=e2)
    312312
    313313>>> time1 = datetime.datetime(2007, 12, 19, 22, 25, 0)
    314314>>> time2 = datetime.datetime(2007, 12, 19, 21, 0, 0)
     
    684684# An empty values() call includes all aliases, including those from an extra()
    685685>>> dicts = qs.values().order_by('id')
    686686>>> [sorted(d.items()) for d in dicts]
    687 [[('author_id', 2), ('good', 0), ('id', 1), ('rank', 2)], [('author_id', 3), ('good', 0), ('id', 2), ('rank', 1)], [('author_id', 1), ('good', 1), ('id', 3), ('rank', 3)]]
     687[[('author_id', 32), ('good', 0), ('id', 1), ('rank', 2)], [('author_id', 33), ('good', 0), ('id', 2), ('rank', 1)], [('author_id', 31), ('good', 1), ('id', 3), ('rank', 3)]]
    688688
    689689Bugs #2874, #3002
    690690>>> qs = Item.objects.select_related().order_by('note__note', 'name')
     
    12331233>>> subq._result_cache is None
    12341234True
    12351235
     1236# Regression test for #12823
     1237>>> qs = Author.objects.exclude(extra__note__annotation__name ='a2')
     1238>>> len(qs)
     12392
    12361240"""}
    12371241
    12381242# In Python 2.3 and the Python 2.6 beta releases, exceptions raised in __len__
Back to Top