From 3d00992d9fefdcdc3bbc3fc85c1a409350391e5c Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Tue, 22 Dec 2009 06:01:23 +0000 Subject: Fixed #11936 -- Removed deferred models from the list returned by the app_cache. Thanks to ryszard for the report, and clamothe for the initial patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@11938 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- tests/modeltests/defer/models.py | 6 ------ tests/regressiontests/defer_regress/models.py | 13 ++++++++----- 2 files changed, 8 insertions(+), 11 deletions(-) (limited to 'tests') diff --git a/tests/modeltests/defer/models.py b/tests/modeltests/defer/models.py index 96eb427811..ac3c876a57 100644 --- a/tests/modeltests/defer/models.py +++ b/tests/modeltests/defer/models.py @@ -183,10 +183,4 @@ u"bar" >>> obj.name = "bb" >>> obj.save() -# Finally, we need to flush the app cache for the defer module. -# Using only/defer creates some artifical entries in the app cache -# that messes up later tests. Purge all entries, just to be sure. ->>> from django.db.models.loading import cache ->>> cache.app_models['defer'] = {} - """} diff --git a/tests/regressiontests/defer_regress/models.py b/tests/regressiontests/defer_regress/models.py index a1cd19788d..d9e7bc6249 100644 --- a/tests/regressiontests/defer_regress/models.py +++ b/tests/regressiontests/defer_regress/models.py @@ -132,11 +132,14 @@ False >>> i2._deferred # Item must still be non-deferred False -# Finally, we need to flush the app cache for the defer module. -# Using only/defer creates some artifical entries in the app cache -# that messes up later tests. Purge all entries, just to be sure. ->>> from django.db.models.loading import cache ->>> cache.app_models['defer_regress'] = {} +# Regression for #11936 - loading.get_models should not return deferred models by default. +>>> from django.db.models.loading import get_models +>>> sorted(get_models(models.get_app('defer_regress')), key=lambda obj: obj.__class__.__name__) +[, , , ] + +>>> sorted(get_models(models.get_app('defer_regress'), include_deferred=True), key=lambda obj: obj.__class__.__name__) +[, , , , , , , , , , , ] """ } + -- cgit v1.3