summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2010-11-17 16:47:46 +0000
committerAlex Gaynor <alex.gaynor@gmail.com>2010-11-17 16:47:46 +0000
commit1aaf270d73e42b28edace569575712cb2cbf1ef6 (patch)
tree17cf5903f1f77b01c65b80b67b1c6053f33be565 /tests
parent6469eec71d9d82d8be2ac62a128273426d78ab5b (diff)
[1.2.X] Fixed #14423 -- corrected incorrect SQL being generated when a nullable, inherited field was used in an exclude. Thanks to PhiR_42 for the patch. Backport of [14600].
git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@14601 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/model_inheritance_regress/tests.py34
1 files changed, 28 insertions, 6 deletions
diff --git a/tests/regressiontests/model_inheritance_regress/tests.py b/tests/regressiontests/model_inheritance_regress/tests.py
index 569cef5845..dac2cb5de5 100644
--- a/tests/regressiontests/model_inheritance_regress/tests.py
+++ b/tests/regressiontests/model_inheritance_regress/tests.py
@@ -3,12 +3,16 @@ Regression tests for Model inheritance behaviour.
"""
import datetime
+from operator import attrgetter
+
from django.test import TestCase
-from regressiontests.model_inheritance_regress.models import (
- Place, Restaurant, ItalianRestaurant, ParkingLot, ParkingLot2,
- ParkingLot3, Supplier, Wholesaler, Child, SelfRefChild, ArticleWithAuthor,
- M2MChild, QualityControl, DerivedM, Person, BirthdayParty, BachelorParty,
- MessyBachelorParty, InternalCertificationAudit)
+
+from models import (Place, Restaurant, ItalianRestaurant, ParkingLot,
+ ParkingLot2, ParkingLot3, Supplier, Wholesaler, Child, SelfRefParent,
+ SelfRefChild, ArticleWithAuthor, M2MChild, QualityControl, DerivedM,
+ Person, BirthdayParty, BachelorParty, MessyBachelorParty,
+ InternalCertificationAudit)
+
class ModelInheritanceTest(TestCase):
def test_model_inheritance(self):
@@ -355,7 +359,10 @@ class ModelInheritanceTest(TestCase):
self.assertEqual(parties, [bachelor, messy_parent])
def test_11369(self):
- """verbose_name_plural correctly inherited from ABC if inheritance chain includes an abstract model."""
+ """
+ verbose_name_plural correctly inherited from ABC if inheritance chain
+ includes an abstract model.
+ """
# Regression test for #11369: verbose_name_plural should be inherited
# from an ABC even when there are one or more intermediate
# abstract models in the inheritance chain, for consistency with
@@ -364,3 +371,18 @@ class ModelInheritanceTest(TestCase):
InternalCertificationAudit._meta.verbose_name_plural,
u'Audits'
)
+
+ def test_inherited_nullable_exclude(self):
+ obj = SelfRefChild.objects.create(child_data=37, parent_data=42)
+ self.assertQuerysetEqual(
+ SelfRefParent.objects.exclude(self_data=72), [
+ obj.pk
+ ],
+ attrgetter("pk")
+ )
+ self.assertQuerysetEqual(
+ SelfRefChild.objects.exclude(self_data=72), [
+ obj.pk
+ ],
+ attrgetter("pk")
+ )