summaryrefslogtreecommitdiff
path: root/tests/generic_relations/tests.py
diff options
context:
space:
mode:
authorAnssi Kääriäinen <akaariai@gmail.com>2013-05-11 03:48:58 +0300
committerAnssi Kääriäinen <akaariai@gmail.com>2013-05-11 03:48:58 +0300
commitc0d8932a6d03e9326a4e407e944b09bf43cf929c (patch)
treec98b8d10658dabfcf17592324e575ff83789ef33 /tests/generic_relations/tests.py
parent92351c74c16f3f234e05cd1792e3a8d5f583301c (diff)
Fixed #19939 -- generic relations + split_exclude regression
Added a test, the issue was already fixed (likely by the patch for #19385).
Diffstat (limited to 'tests/generic_relations/tests.py')
-rw-r--r--tests/generic_relations/tests.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/generic_relations/tests.py b/tests/generic_relations/tests.py
index dd9dc506ca..79c7bc6184 100644
--- a/tests/generic_relations/tests.py
+++ b/tests/generic_relations/tests.py
@@ -6,7 +6,7 @@ from django.contrib.contenttypes.models import ContentType
from django.test import TestCase
from .models import (TaggedItem, ValuableTaggedItem, Comparison, Animal,
- Vegetable, Mineral, Gecko, Rock)
+ Vegetable, Mineral, Gecko, Rock, ManualPK)
class GenericRelationsTests(TestCase):
@@ -75,12 +75,17 @@ class GenericRelationsTests(TestCase):
"<Animal: Lion>",
"<Animal: Platypus>"
])
+ # Create another fatty tagged instance with different PK to ensure
+ # there is a content type restriction in the generated queries below.
+ mpk = ManualPK.objects.create(id=lion.pk)
+ mpk.tags.create(tag="fatty")
self.assertQuerysetEqual(Animal.objects.filter(tags__tag='fatty'), [
"<Animal: Platypus>"
])
self.assertQuerysetEqual(Animal.objects.exclude(tags__tag='fatty'), [
"<Animal: Lion>"
])
+ mpk.delete()
# If you delete an object with an explicit Generic relation, the related
# objects are deleted when the source object is deleted.