Ticket #12823: 12823_1.1.diff
File 12823_1.1.diff, 3.6 KB (added by , 14 years ago) |
---|
-
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 1945 1945 query.bump_prefix() 1946 1946 query.clear_ordering(True) 1947 1947 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, 1949 1950 can_reuse=can_reuse) 1950 1951 1951 1952 # 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 291 291 >>> t4 = Tag.objects.create(name='t4', parent=t3) 292 292 >>> t5 = Tag.objects.create(name='t5', parent=t3) 293 293 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') 297 297 298 >>> ann1 = Annotation.objects.create( name='a1', tag=t1)298 >>> ann1 = Annotation.objects.create(id=10, name='a1', tag=t1) 299 299 >>> ann1.notes.add(n1) 300 >>> ann2 = Annotation.objects.create( name='a2', tag=t4)300 >>> ann2 = Annotation.objects.create(id=11, name='a2', tag=t4) 301 301 >>> ann2.notes.add(n2, n3) 302 302 303 303 Create these out of order so that sorting by 'id' will be different to sorting 304 304 by 'info'. Helps detect some problems later. 305 >>> e2 = ExtraInfo.objects.create(i nfo='e2', note=n2)306 >>> e1 = ExtraInfo.objects.create(i nfo='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) 307 307 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) 312 312 313 313 >>> time1 = datetime.datetime(2007, 12, 19, 22, 25, 0) 314 314 >>> time2 = datetime.datetime(2007, 12, 19, 21, 0, 0) … … 684 684 # An empty values() call includes all aliases, including those from an extra() 685 685 >>> dicts = qs.values().order_by('id') 686 686 >>> [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)]] 688 688 689 689 Bugs #2874, #3002 690 690 >>> qs = Item.objects.select_related().order_by('note__note', 'name') … … 1233 1233 >>> subq._result_cache is None 1234 1234 True 1235 1235 1236 # Regression test for #12823 1237 >>> qs = Author.objects.exclude(extra__note__annotation__name ='a2') 1238 >>> len(qs) 1239 2 1236 1240 """} 1237 1241 1238 1242 # In Python 2.3 and the Python 2.6 beta releases, exceptions raised in __len__