1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Deprecated importing a model before loading its application.

Refs #21719, #21680.
This commit is contained in:
Aymeric Augustin
2014-01-10 23:06:19 +01:00
parent 81bb8d1220
commit 3326a412cc
5 changed files with 40 additions and 5 deletions

View File

@@ -130,6 +130,11 @@ def setup(verbosity, test_labels):
'django.contrib.comments is deprecated and will be removed before Django 1.8.',
DeprecationWarning
)
warnings.filterwarnings(
'ignore',
'Model class django.contrib.comments.models.*supported in Django 1.9.',
PendingDeprecationWarning
)
# Load all the ALWAYS_INSTALLED_APPS.
django.setup()
@@ -169,8 +174,8 @@ def setup(verbosity, test_labels):
if module_label not in settings.INSTALLED_APPS:
settings.INSTALLED_APPS.append(module_label)
app_config = AppConfig.create(module_label)
app_config.import_models(apps.all_models[app_config.label])
apps.app_configs[app_config.label] = app_config
app_config.import_models(apps.all_models[app_config.label])
apps.clear_cache()
return state