1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Fixed #14423 -- corrected incorrect SQL being generated when a nullable, inherited field was used in an exclude. Thanks to PhiR_42 for the patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14600 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Alex Gaynor
2010-11-17 16:46:50 +00:00
parent c0248f6f07
commit 0eb31d3dc9
2 changed files with 34 additions and 10 deletions

View File

@@ -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")
)