Fixed #16480 -- Modified test added in r16522 so it doesn't use a query not supported under Oracle (`GROUP BY` a NCLOB field). Thanks Aymeric for the report. Refs #4186

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16546 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Ramiro Morales 2011-07-17 22:22:39 +00:00
parent 9896b0df73
commit 0452d4c3cc
2 changed files with 18 additions and 3 deletions

View File

@ -36,3 +36,13 @@ class ResolveThis(models.Model):
class Proxy(Item): class Proxy(Item):
class Meta: class Meta:
proxy = True proxy = True
class SimpleItem(models.Model):
name = models.CharField(max_length=15)
value = models.IntegerField()
def __unicode__(self):
return self.name
class Feature(models.Model):
item = models.ForeignKey(SimpleItem)

View File

@ -6,7 +6,8 @@ from django.db.models import Count
from django.db.models.loading import cache from django.db.models.loading import cache
from django.test import TestCase from django.test import TestCase
from models import ResolveThis, Item, RelatedItem, Child, Leaf, Proxy from models import (ResolveThis, Item, RelatedItem, Child, Leaf, Proxy,
SimpleItem, Feature)
class DeferRegressionTest(TestCase): class DeferRegressionTest(TestCase):
@ -108,11 +109,13 @@ class DeferRegressionTest(TestCase):
self.assertEqual( self.assertEqual(
klasses, [ klasses, [
Child, Child,
Feature,
Item, Item,
Leaf, Leaf,
Proxy, Proxy,
RelatedItem, RelatedItem,
ResolveThis, ResolveThis,
SimpleItem,
] ]
) )
@ -128,6 +131,7 @@ class DeferRegressionTest(TestCase):
klasses, [ klasses, [
"Child", "Child",
"Child_Deferred_value", "Child_Deferred_value",
"Feature",
"Item", "Item",
"Item_Deferred_name", "Item_Deferred_name",
"Item_Deferred_name_other_value_text", "Item_Deferred_name_other_value_text",
@ -144,12 +148,13 @@ class DeferRegressionTest(TestCase):
"RelatedItem_Deferred_", "RelatedItem_Deferred_",
"RelatedItem_Deferred_item_id", "RelatedItem_Deferred_item_id",
"ResolveThis", "ResolveThis",
"SimpleItem",
] ]
) )
# Regression for #16409 - make sure defer() and only() work with annotate() # Regression for #16409 - make sure defer() and only() work with annotate()
self.assertIsInstance(list(Item.objects.annotate(Count('relateditem')).defer('name')), list) self.assertIsInstance(list(SimpleItem.objects.annotate(Count('feature')).defer('name')), list)
self.assertIsInstance(list(Item.objects.annotate(Count('relateditem')).only('name')), list) self.assertIsInstance(list(SimpleItem.objects.annotate(Count('feature')).only('name')), list)
def test_only_and_defer_usage_on_proxy_models(self): def test_only_and_defer_usage_on_proxy_models(self):
# Regression for #15790 - only() broken for proxy models # Regression for #15790 - only() broken for proxy models