Ticket #15316: 15316_with_test.diff
File 15316_with_test.diff, 2.4 KB (added by , 13 years ago) |
---|
-
django/db/models/sql/query.py
1075 1075 can_reuse) 1076 1076 return 1077 1077 1078 if (lookup_type == 'isnull' and value is True andnot negate and1078 if (lookup_type == 'isnull' and not negate and 1079 1079 len(join_list) > 1): 1080 1080 # If the comparison is against NULL, we may need to use some left 1081 1081 # outer joins when creating the join chain. This is only done when -
tests/regressiontests/queries/tests.py
15 15 DumbCategory, ExtraInfo, Fan, Item, LeafA, LoopX, LoopZ, ManagedModel, 16 16 Member, NamedCategory, Note, Number, Plaything, PointerA, Ranking, Related, 17 17 Report, ReservedName, Tag, TvChef, Valid, X, Food, Eaten, Node, ObjectA, ObjectB, 18 ObjectC )18 ObjectC, CategoryItem) 19 19 20 20 21 21 class BaseQuerysetTest(TestCase): … … 1032 1032 [] 1033 1033 ) 1034 1034 1035 def test_ticket15316(self): 1036 c1 = NamedCategory(name="category1") 1037 c2 = DumbCategory() 1038 c1.save() 1039 c2.save() 1035 1040 1041 ci1 = CategoryItem(category=c1) 1042 ci2 = CategoryItem(category=c2) 1043 ci1.save() 1044 ci2.save() 1045 1046 self.assertEqual( 1047 CategoryItem.objects.filter(category__namedcategory__isnull=False).count(), 1048 1 1049 ) 1050 1036 1051 class Queries5Tests(TestCase): 1037 1052 def setUp(self): 1038 1053 # Ordering by 'rank' gives us rank2, rank1, rank3. Ordering by the Meta.ordering -
tests/regressiontests/queries/models.py
12 12 class NamedCategory(DumbCategory): 13 13 name = models.CharField(max_length=10) 14 14 15 class CategoryItem(models.Model): 16 category = models.ForeignKey(DumbCategory) 17 18 def __unicode__(self): 19 return "category item: " + str(self.category) 20 15 21 class Tag(models.Model): 16 22 name = models.CharField(max_length=10) 17 23 parent = models.ForeignKey('self', blank=True, null=True,