Moved apps back in the toplevel django namespace.

Reverted 4a56a93cc4.
This commit is contained in:
Aymeric Augustin 2013-12-22 11:35:17 +01:00
parent 99bd39ef6e
commit 2fef9e5375
95 changed files with 101 additions and 101 deletions

View File

@ -6,7 +6,7 @@ from django.contrib.auth import logout as auth_logout, REDIRECT_FIELD_NAME
from django.contrib.contenttypes import views as contenttype_views from django.contrib.contenttypes import views as contenttype_views
from django.views.decorators.csrf import csrf_protect from django.views.decorators.csrf import csrf_protect
from django.db.models.base import ModelBase from django.db.models.base import ModelBase
from django.core.apps import app_cache from django.apps import app_cache
from django.core.exceptions import ImproperlyConfigured, PermissionDenied from django.core.exceptions import ImproperlyConfigured, PermissionDenied
from django.core.urlresolvers import reverse, NoReverseMatch from django.core.urlresolvers import reverse, NoReverseMatch
from django.template.response import TemplateResponse from django.template.response import TemplateResponse

View File

@ -1,4 +1,4 @@
from django.core.apps import app_cache from django.apps import app_cache
from django.template import Library from django.template import Library
register = Library() register = Library()

View File

@ -1,4 +1,4 @@
from django.core.apps import app_cache from django.apps import app_cache
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
from django.db import models from django.db import models
from django.db.models.fields import FieldDoesNotExist from django.db.models.fields import FieldDoesNotExist

View File

@ -5,10 +5,10 @@ import re
import warnings import warnings
from django import template from django import template
from django.apps import app_cache
from django.conf import settings from django.conf import settings
from django.contrib import admin from django.contrib import admin
from django.contrib.admin.views.decorators import staff_member_required from django.contrib.admin.views.decorators import staff_member_required
from django.core.apps import app_cache
from django.db import models from django.db import models
from django.core.exceptions import ViewDoesNotExist from django.core.exceptions import ViewDoesNotExist
from django.http import Http404 from django.http import Http404

View File

@ -123,7 +123,7 @@ def get_user_model():
""" """
Returns the User model that is active in this project. Returns the User model that is active in this project.
""" """
from django.core.apps import app_cache from django.apps import app_cache
try: try:
app_label, model_name = settings.AUTH_USER_MODEL.split('.') app_label, model_name = settings.AUTH_USER_MODEL.split('.')

View File

@ -6,9 +6,9 @@ from __future__ import unicode_literals
import getpass import getpass
import unicodedata import unicodedata
from django.apps import app_cache, UnavailableApp
from django.contrib.auth import (models as auth_app, get_permission_codename, from django.contrib.auth import (models as auth_app, get_permission_codename,
get_user_model) get_user_model)
from django.core.apps import app_cache, UnavailableApp
from django.core import exceptions from django.core import exceptions
from django.core.management.base import CommandError from django.core.management.base import CommandError
from django.db import DEFAULT_DB_ALIAS, router from django.db import DEFAULT_DB_ALIAS, router

View File

@ -1,6 +1,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from datetime import date from datetime import date
from django.apps import app_cache
from django.contrib.auth import models, management from django.contrib.auth import models, management
from django.contrib.auth.management import create_permissions from django.contrib.auth.management import create_permissions
from django.contrib.auth.management.commands import changepassword from django.contrib.auth.management.commands import changepassword
@ -8,7 +9,6 @@ from django.contrib.auth.models import User
from django.contrib.auth.tests.custom_user import CustomUser from django.contrib.auth.tests.custom_user import CustomUser
from django.contrib.auth.tests.utils import skipIfCustomUser from django.contrib.auth.tests.utils import skipIfCustomUser
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.core.apps import app_cache
from django.core import exceptions from django.core import exceptions
from django.core.management import call_command from django.core.management import call_command
from django.core.management.base import CommandError from django.core.management.base import CommandError

View File

@ -1,8 +1,8 @@
from importlib import import_module from importlib import import_module
import warnings import warnings
from django.apps import app_cache
from django.conf import settings from django.conf import settings
from django.core import urlresolvers from django.core import urlresolvers
from django.core.apps import app_cache
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
from django.contrib.comments.models import Comment from django.contrib.comments.models import Comment
from django.contrib.comments.forms import CommentForm from django.contrib.comments.forms import CommentForm

View File

@ -1,9 +1,9 @@
from django import http from django import http
from django.apps import app_cache
from django.conf import settings from django.conf import settings
from django.contrib import comments from django.contrib import comments
from django.contrib.comments import signals from django.contrib.comments import signals
from django.contrib.comments.views.utils import next_redirect, confirmation_view from django.contrib.comments.views.utils import next_redirect, confirmation_view
from django.core.apps import app_cache
from django.core.exceptions import ObjectDoesNotExist, ValidationError from django.core.exceptions import ObjectDoesNotExist, ValidationError
from django.db import models from django.db import models
from django.shortcuts import render_to_response from django.shortcuts import render_to_response

View File

@ -1,5 +1,5 @@
from django.apps import app_cache, UnavailableApp
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.core.apps import app_cache, UnavailableApp
from django.db import DEFAULT_DB_ALIAS, router from django.db import DEFAULT_DB_ALIAS, router
from django.db.models import signals from django.db.models import signals
from django.utils.encoding import smart_text from django.utils.encoding import smart_text

View File

@ -1,4 +1,4 @@
from django.core.apps import app_cache from django.apps import app_cache
from django.db import models from django.db import models
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import smart_text, force_text from django.utils.encoding import smart_text, force_text

View File

@ -1,9 +1,9 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from django.apps import app_cache
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes.views import shortcut from django.contrib.contenttypes.views import shortcut
from django.contrib.sites.models import get_current_site from django.contrib.sites.models import get_current_site
from django.core.apps import app_cache
from django.db import models from django.db import models
from django.http import HttpRequest, Http404 from django.http import HttpRequest, Http404
from django.test import TestCase from django.test import TestCase

View File

@ -1,4 +1,4 @@
from django.core.apps import app_cache from django.apps import app_cache
from django.core import urlresolvers from django.core import urlresolvers
from django.contrib.sitemaps import Sitemap from django.contrib.sitemaps import Sitemap
from django.contrib.gis.db.models.fields import GeometryField from django.contrib.gis.db.models.fields import GeometryField

View File

@ -2,7 +2,7 @@ from __future__ import unicode_literals
import warnings import warnings
from django.core.apps import app_cache from django.apps import app_cache
from django.http import HttpResponse, Http404 from django.http import HttpResponse, Http404
from django.template import loader from django.template import loader
from django.contrib.sites.models import get_current_site from django.contrib.sites.models import get_current_site

View File

@ -3,11 +3,11 @@ from __future__ import unicode_literals
from unittest import skipUnless from unittest import skipUnless
from xml.dom import minidom from xml.dom import minidom
from django.apps import app_cache
from django.conf import settings from django.conf import settings
from django.contrib.sites.models import Site from django.contrib.sites.models import Site
from django.contrib.gis.geos import HAS_GEOS from django.contrib.gis.geos import HAS_GEOS
from django.contrib.gis.tests.utils import HAS_SPATIAL_DB from django.contrib.gis.tests.utils import HAS_SPATIAL_DB
from django.core.apps import app_cache
from django.test import TestCase from django.test import TestCase
if HAS_GEOS: if HAS_GEOS:

View File

@ -6,11 +6,11 @@ from xml.dom import minidom
import os import os
import zipfile import zipfile
from django.apps import app_cache
from django.conf import settings from django.conf import settings
from django.contrib.gis.geos import HAS_GEOS from django.contrib.gis.geos import HAS_GEOS
from django.contrib.gis.tests.utils import HAS_SPATIAL_DB from django.contrib.gis.tests.utils import HAS_SPATIAL_DB
from django.contrib.sites.models import Site from django.contrib.sites.models import Site
from django.core.apps import app_cache
from django.test import TestCase from django.test import TestCase
from django.test.utils import IgnoreDeprecationWarningsMixin from django.test.utils import IgnoreDeprecationWarningsMixin
from django.utils._os import upath from django.utils._os import upath

View File

@ -1,13 +1,13 @@
from unittest import skipUnless from unittest import skipUnless
from django import http from django import http
from django.apps import app_cache
from django.conf import settings, global_settings from django.conf import settings, global_settings
from django.contrib.messages import constants, utils, get_level, set_level from django.contrib.messages import constants, utils, get_level, set_level
from django.contrib.messages.api import MessageFailure from django.contrib.messages.api import MessageFailure
from django.contrib.messages.constants import DEFAULT_LEVELS from django.contrib.messages.constants import DEFAULT_LEVELS
from django.contrib.messages.storage import default_storage, base from django.contrib.messages.storage import default_storage, base
from django.contrib.messages.storage.base import Message from django.contrib.messages.storage.base import Message
from django.core.apps import app_cache
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.test.utils import override_settings from django.test.utils import override_settings
from django.utils.translation import ugettext_lazy from django.utils.translation import ugettext_lazy

View File

@ -1,9 +1,9 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from django.apps import app_cache
from django.conf import settings from django.conf import settings
from django.contrib.redirects.models import Redirect from django.contrib.redirects.models import Redirect
from django.contrib.sites.models import get_current_site from django.contrib.sites.models import get_current_site
from django.core.apps import app_cache
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
from django import http from django import http

View File

@ -1,7 +1,7 @@
from django import http from django import http
from django.apps import app_cache
from django.conf import settings from django.conf import settings
from django.contrib.sites.models import Site from django.contrib.sites.models import Site
from django.core.apps import app_cache
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase from django.test import TestCase
from django.test.utils import override_settings from django.test.utils import override_settings

View File

@ -2,8 +2,8 @@ from __future__ import unicode_literals
from unittest import skipUnless from unittest import skipUnless
from django.apps import app_cache
from django.conf import settings from django.conf import settings
from django.core.apps import app_cache
from .base import SitemapTestsBase from .base import SitemapTestsBase

View File

@ -4,10 +4,10 @@ import os
from datetime import date from datetime import date
from unittest import skipUnless from unittest import skipUnless
from django.apps import app_cache
from django.conf import settings from django.conf import settings
from django.contrib.sitemaps import Sitemap, GenericSitemap from django.contrib.sitemaps import Sitemap, GenericSitemap
from django.contrib.sites.models import Site from django.contrib.sites.models import Site
from django.core.apps import app_cache
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
from django.test.utils import override_settings from django.test.utils import override_settings
from django.utils.formats import localize from django.utils.formats import localize

View File

@ -1,8 +1,8 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from django.apps import app_cache
from django.conf import settings from django.conf import settings
from django.contrib.sites.models import Site, RequestSite, get_current_site from django.contrib.sites.models import Site, RequestSite, get_current_site
from django.core.apps import app_cache
from django.core.exceptions import ObjectDoesNotExist, ValidationError from django.core.exceptions import ObjectDoesNotExist, ValidationError
from django.http import HttpRequest from django.http import HttpRequest
from django.test import TestCase from django.test import TestCase

View File

@ -1,8 +1,8 @@
from collections import OrderedDict from collections import OrderedDict
import os import os
from django.apps import app_cache
from django.conf import settings from django.conf import settings
from django.core.apps import app_cache
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
from django.core.files.storage import default_storage, Storage, FileSystemStorage from django.core.files.storage import default_storage, Storage, FileSystemStorage
from django.utils.functional import empty, LazyObject from django.utils.functional import empty, LazyObject

View File

@ -1,6 +1,6 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from django.core.apps import app_cache from django.apps import app_cache
from django.db import models from django.db import models

View File

@ -117,7 +117,7 @@ def get_commands():
# Populate the app cache outside of the try/except block to avoid # Populate the app cache outside of the try/except block to avoid
# catching ImproperlyConfigured errors that aren't caused by the # catching ImproperlyConfigured errors that aren't caused by the
# absence of a settings module. # absence of a settings module.
from django.core.apps import app_cache from django.apps import app_cache
app_configs = app_cache.get_app_configs() app_configs = app_cache.get_app_configs()
apps = [app_config.name for app_config in app_configs] apps = [app_config.name for app_config in app_configs]
@ -346,7 +346,7 @@ class ManagementUtility(object):
elif cwords[0] in ('dumpdata', 'sql', 'sqlall', 'sqlclear', elif cwords[0] in ('dumpdata', 'sql', 'sqlall', 'sqlclear',
'sqlcustom', 'sqlindexes', 'sqlsequencereset', 'test'): 'sqlcustom', 'sqlindexes', 'sqlsequencereset', 'test'):
try: try:
from django.core.apps import app_cache from django.apps import app_cache
app_configs = app_cache.get_app_configs() app_configs = app_cache.get_app_configs()
# Get the last part of the dotted path as the app name. # Get the last part of the dotted path as the app name.
options += [(app_config.label, 0) for app_config in app_configs] options += [(app_config.label, 0) for app_config in app_configs]

View File

@ -341,7 +341,7 @@ class AppCommand(BaseCommand):
args = '<appname appname ...>' args = '<appname appname ...>'
def handle(self, *app_labels, **options): def handle(self, *app_labels, **options):
from django.core.apps import app_cache from django.apps import app_cache
if not app_labels: if not app_labels:
raise CommandError('Enter at least one appname.') raise CommandError('Enter at least one appname.')
# Populate models and don't use only_with_models_module=True when # Populate models and don't use only_with_models_module=True when

View File

@ -37,7 +37,7 @@ class Command(BaseCommand):
args = '[appname appname.ModelName ...]' args = '[appname appname.ModelName ...]'
def handle(self, *app_labels, **options): def handle(self, *app_labels, **options):
from django.core.apps import app_cache from django.apps import app_cache
format = options.get('format') format = options.get('format')
indent = options.get('indent') indent = options.get('indent')
@ -162,7 +162,7 @@ def sort_dependencies(app_list):
is serialized before a normal model, and any model with a natural key is serialized before a normal model, and any model with a natural key
dependency has it's dependencies serialized first. dependency has it's dependencies serialized first.
""" """
from django.core.apps import app_cache from django.apps import app_cache
# Process the list of models, and get the list of dependencies # Process the list of models, and get the list of dependencies
model_dependencies = [] model_dependencies = []
models = set() models = set()

View File

@ -2,7 +2,7 @@ import sys
from importlib import import_module from importlib import import_module
from optparse import make_option from optparse import make_option
from django.core.apps import app_cache from django.apps import app_cache
from django.db import connections, router, transaction, DEFAULT_DB_ALIAS from django.db import connections, router, transaction, DEFAULT_DB_ALIAS
from django.core.management import call_command from django.core.management import call_command
from django.core.management.base import NoArgsCommand, CommandError from django.core.management.base import NoArgsCommand, CommandError

View File

@ -7,8 +7,8 @@ import warnings
import zipfile import zipfile
from optparse import make_option from optparse import make_option
from django.apps import app_cache
from django.conf import settings from django.conf import settings
from django.core.apps import app_cache
from django.core import serializers from django.core import serializers
from django.core.management.base import BaseCommand, CommandError from django.core.management.base import BaseCommand, CommandError
from django.core.management.color import no_style from django.core.management.color import no_style

View File

@ -3,7 +3,7 @@ import os
import operator import operator
from optparse import make_option from optparse import make_option
from django.core.apps import app_cache from django.apps import app_cache
from django.core.management.base import BaseCommand, CommandError from django.core.management.base import BaseCommand, CommandError
from django.db import connections, DEFAULT_DB_ALIAS, migrations from django.db import connections, DEFAULT_DB_ALIAS, migrations
from django.db.migrations.loader import MigrationLoader from django.db.migrations.loader import MigrationLoader

View File

@ -6,7 +6,7 @@ from importlib import import_module
import itertools import itertools
import traceback import traceback
from django.core.apps import app_cache from django.apps import app_cache
from django.core.management import call_command from django.core.management import call_command
from django.core.management.base import BaseCommand, CommandError from django.core.management.base import BaseCommand, CommandError
from django.core.management.color import no_style from django.core.management.color import no_style

View File

@ -66,7 +66,7 @@ class Command(NoArgsCommand):
def handle_noargs(self, **options): def handle_noargs(self, **options):
# XXX: (Temporary) workaround for ticket #1796: force early loading of all # XXX: (Temporary) workaround for ticket #1796: force early loading of all
# models from installed apps. # models from installed apps.
from django.core.apps import app_cache from django.apps import app_cache
app_cache.get_models() app_cache.get_models()
use_plain = options.get('plain', False) use_plain = options.get('plain', False)

View File

@ -2,7 +2,7 @@ from __future__ import unicode_literals
from optparse import make_option from optparse import make_option
from django.core.apps import app_cache from django.apps import app_cache
from django.core.management.base import AppCommand from django.core.management.base import AppCommand
from django.db import connections, DEFAULT_DB_ALIAS from django.db import connections, DEFAULT_DB_ALIAS

View File

@ -5,8 +5,8 @@ import os
import re import re
import warnings import warnings
from django.apps import app_cache
from django.conf import settings from django.conf import settings
from django.core.apps import app_cache
from django.core.management.base import CommandError from django.core.management.base import CommandError
from django.db import models, router from django.db import models, router

View File

@ -26,7 +26,7 @@ def get_validation_errors(outfile, app=None):
validates all models of all installed apps. Writes errors, if any, to outfile. validates all models of all installed apps. Writes errors, if any, to outfile.
Returns number of errors. Returns number of errors.
""" """
from django.core.apps import app_cache from django.apps import app_cache
from django.db import connection, models from django.db import connection, models
from django.db.models.deletion import SET_NULL, SET_DEFAULT from django.db.models.deletion import SET_NULL, SET_DEFAULT

View File

@ -3,7 +3,7 @@ Module for abstract serializer/unserializer base classes.
""" """
import warnings import warnings
from django.core.apps import app_cache from django.apps import app_cache
from django.db import models from django.db import models
from django.utils import six from django.utils import six

View File

@ -5,8 +5,8 @@ other serializers.
""" """
from __future__ import unicode_literals from __future__ import unicode_literals
from django.apps import app_cache
from django.conf import settings from django.conf import settings
from django.core.apps import app_cache
from django.core.serializers import base from django.core.serializers import base
from django.db import models, DEFAULT_DB_ALIAS from django.db import models, DEFAULT_DB_ALIAS
from django.utils.encoding import smart_text, is_protected_type from django.utils.encoding import smart_text, is_protected_type

View File

@ -4,8 +4,8 @@ XML serializer.
from __future__ import unicode_literals from __future__ import unicode_literals
from django.apps import app_cache
from django.conf import settings from django.conf import settings
from django.core.apps import app_cache
from django.core.serializers import base from django.core.serializers import base
from django.db import models, DEFAULT_DB_ALIAS from django.db import models, DEFAULT_DB_ALIAS
from django.utils.xmlutils import SimplerXMLGenerator from django.utils.xmlutils import SimplerXMLGenerator

View File

@ -1268,7 +1268,7 @@ class BaseDatabaseIntrospection(object):
If only_existing is True, the resulting list will only include the tables If only_existing is True, the resulting list will only include the tables
that actually exist in the database. that actually exist in the database.
""" """
from django.core.apps import app_cache from django.apps import app_cache
from django.db import router from django.db import router
tables = set() tables = set()
for app_config in app_cache.get_app_configs(only_with_models_module=True): for app_config in app_cache.get_app_configs(only_with_models_module=True):
@ -1289,7 +1289,7 @@ class BaseDatabaseIntrospection(object):
def installed_models(self, tables): def installed_models(self, tables):
"Returns a set of all models represented by the provided list of table names." "Returns a set of all models represented by the provided list of table names."
from django.core.apps import app_cache from django.apps import app_cache
from django.db import router from django.db import router
all_models = [] all_models = []
for app_config in app_cache.get_app_configs(only_with_models_module=True): for app_config in app_cache.get_app_configs(only_with_models_module=True):
@ -1302,7 +1302,7 @@ class BaseDatabaseIntrospection(object):
def sequence_list(self): def sequence_list(self):
"Returns a list of information about all DB sequences for all models in all apps." "Returns a list of information about all DB sequences for all models in all apps."
from django.core.apps import app_cache from django.apps import app_cache
from django.db import models, router from django.db import models, router
sequence_list = [] sequence_list = []

View File

@ -1,4 +1,4 @@
from django.core.apps.cache import AppCache from django.apps.cache import AppCache
from django.db.backends.schema import BaseDatabaseSchemaEditor from django.db.backends.schema import BaseDatabaseSchemaEditor
from django.db.models.fields.related import ManyToManyField from django.db.models.fields.related import ManyToManyField

View File

@ -2,7 +2,7 @@ from importlib import import_module
import os import os
import sys import sys
from django.core.apps import app_cache from django.apps import app_cache
from django.db.migrations.recorder import MigrationRecorder from django.db.migrations.recorder import MigrationRecorder
from django.db.migrations.graph import MigrationGraph from django.db.migrations.graph import MigrationGraph
from django.utils import six from django.utils import six

View File

@ -2,7 +2,7 @@ import importlib
import os import os
import sys import sys
from django.core.apps import app_cache from django.apps import app_cache
from django.utils import datetime_safe from django.utils import datetime_safe
from django.utils.six.moves import input from django.utils.six.moves import input

View File

@ -1,4 +1,4 @@
from django.core.apps.cache import AppCache from django.apps.cache import AppCache
from django.db import models from django.db import models
from django.utils.timezone import now from django.utils.timezone import now

View File

@ -1,4 +1,4 @@
from django.core.apps.cache import AppCache from django.apps.cache import AppCache
from django.db import models from django.db import models
from django.db.models.options import DEFAULT_NAMES, normalize_unique_together from django.db.models.options import DEFAULT_NAMES, normalize_unique_together
from django.utils import six from django.utils import six

View File

@ -5,7 +5,7 @@ from importlib import import_module
import os import os
import types import types
from django.core.apps import app_cache from django.apps import app_cache
from django.db import models from django.db import models
from django.db.migrations.loader import MigrationLoader from django.db.migrations.loader import MigrationLoader
from django.utils.encoding import force_text from django.utils.encoding import force_text

View File

@ -5,8 +5,8 @@ import sys
from functools import update_wrapper from functools import update_wrapper
from django.utils.six.moves import zip from django.utils.six.moves import zip
from django.core.apps import app_cache from django.apps import app_cache
from django.core.apps.base import MODELS_MODULE_NAME from django.apps.base import MODELS_MODULE_NAME
import django.db.models.manager # NOQA: Imported to register signal handler. import django.db.models.manager # NOQA: Imported to register signal handler.
from django.conf import settings from django.conf import settings
from django.core.exceptions import (ObjectDoesNotExist, from django.core.exceptions import (ObjectDoesNotExist,

View File

@ -9,7 +9,7 @@ import warnings
from base64 import b64decode, b64encode from base64 import b64decode, b64encode
from itertools import tee from itertools import tee
from django.core.apps import app_cache from django.apps import app_cache
from django.db import connection from django.db import connection
from django.db.models.query_utils import QueryWrapper from django.db.models.query_utils import QueryWrapper
from django.conf import settings from django.conf import settings

View File

@ -1,6 +1,6 @@
import warnings import warnings
from django.core.apps import app_cache from django.apps import app_cache
warnings.warn( warnings.warn(
"The utilities in django.db.models.loading are deprecated " "The utilities in django.db.models.loading are deprecated "

View File

@ -5,8 +5,8 @@ import re
from bisect import bisect from bisect import bisect
import warnings import warnings
from django.apps import app_cache
from django.conf import settings from django.conf import settings
from django.core.apps import app_cache
from django.db.models.fields.related import ManyToManyRel from django.db.models.fields.related import ManyToManyRel
from django.db.models.fields import AutoField, FieldDoesNotExist from django.db.models.fields import AutoField, FieldDoesNotExist
from django.db.models.fields.proxy import OrderWrt from django.db.models.fields.proxy import OrderWrt

View File

@ -1,6 +1,6 @@
from collections import defaultdict from collections import defaultdict
from django.core.apps import app_cache from django.apps import app_cache
from django.dispatch import Signal from django.dispatch import Signal
from django.utils import six from django.utils import six

View File

@ -282,6 +282,6 @@ class ConnectionRouter(object):
""" """
Return app models allowed to be synchronized on provided db. Return app models allowed to be synchronized on provided db.
""" """
from django.core.apps import app_cache from django.apps import app_cache
return [model for model in app_cache.get_models(app, include_auto_created=include_auto_created) return [model for model in app_cache.get_models(app, include_auto_created=include_auto_created)
if self.allow_migrate(db, model)] if self.allow_migrate(db, model)]

View File

@ -5,8 +5,8 @@ from functools import partial
from importlib import import_module from importlib import import_module
from inspect import getargspec, getcallargs from inspect import getargspec, getcallargs
from django.apps import app_cache
from django.conf import settings from django.conf import settings
from django.core.apps import app_cache
from django.template.context import (BaseContext, Context, RequestContext, # NOQA: imported for backwards compatibility from django.template.context import (BaseContext, Context, RequestContext, # NOQA: imported for backwards compatibility
ContextPopException) ContextPopException)
from django.utils.itercompat import is_iterable from django.utils.itercompat import is_iterable

View File

@ -6,8 +6,8 @@ packages.
import os import os
import sys import sys
from django.apps import app_cache
from django.conf import settings from django.conf import settings
from django.core.apps import app_cache
from django.template.base import TemplateDoesNotExist from django.template.base import TemplateDoesNotExist
from django.template.loader import BaseLoader from django.template.loader import BaseLoader
from django.utils._os import safe_join from django.utils._os import safe_join

View File

@ -6,8 +6,8 @@ try:
except ImportError: except ImportError:
resource_string = None resource_string = None
from django.apps import app_cache
from django.conf import settings from django.conf import settings
from django.core.apps import app_cache
from django.template.base import TemplateDoesNotExist from django.template.base import TemplateDoesNotExist
from django.template.loader import BaseLoader from django.template.loader import BaseLoader
from django.utils import six from django.utils import six

View File

@ -8,9 +8,9 @@ from copy import copy
from importlib import import_module from importlib import import_module
from io import BytesIO from io import BytesIO
from django.apps import app_cache
from django.conf import settings from django.conf import settings
from django.contrib.auth import authenticate, login, logout, get_user_model from django.contrib.auth import authenticate, login, logout, get_user_model
from django.core.apps import app_cache
from django.core.handlers.base import BaseHandler from django.core.handlers.base import BaseHandler
from django.core.handlers.wsgi import WSGIRequest from django.core.handlers.wsgi import WSGIRequest
from django.core.signals import (request_started, request_finished, from django.core.signals import (request_started, request_finished,

View File

@ -9,7 +9,7 @@ import re
import unittest as real_unittest import unittest as real_unittest
import warnings import warnings
from django.core.apps import app_cache from django.apps import app_cache
from django.test import _doctest as doctest from django.test import _doctest as doctest
from django.test import runner from django.test import runner
from django.test.utils import compare_xml, strip_quotes from django.test.utils import compare_xml, strip_quotes

View File

@ -15,9 +15,9 @@ import unittest
from unittest import skipIf # NOQA: Imported here for backward compatibility from unittest import skipIf # NOQA: Imported here for backward compatibility
from unittest.util import safe_repr from unittest.util import safe_repr
from django.apps import app_cache
from django.conf import settings from django.conf import settings
from django.core import mail from django.core import mail
from django.core.apps import app_cache
from django.core.exceptions import ValidationError, ImproperlyConfigured from django.core.exceptions import ValidationError, ImproperlyConfigured
from django.core.handlers.wsgi import get_path_info, WSGIHandler from django.core.handlers.wsgi import get_path_info, WSGIHandler
from django.core.management import call_command from django.core.management import call_command

View File

@ -36,8 +36,8 @@ import sys
import time import time
import traceback import traceback
from django.apps import app_cache
from django.conf import settings from django.conf import settings
from django.core.apps import app_cache
from django.core.signals import request_finished from django.core.signals import request_finished
try: try:
from django.utils.six.moves import _thread as thread from django.utils.six.moves import _thread as thread

View File

@ -58,7 +58,7 @@ def autodiscover_modules(*args, **kwargs):
registry. This register_to object must have a _registry instance variable registry. This register_to object must have a _registry instance variable
to access it. to access it.
""" """
from django.core.apps import app_cache from django.apps import app_cache
register_to = kwargs.get('register_to') register_to = kwargs.get('register_to')
for app_config in app_cache.get_app_configs(): for app_config in app_cache.get_app_configs():

View File

@ -10,7 +10,7 @@ import gettext as gettext_module
from threading import local from threading import local
import warnings import warnings
from django.core.apps import app_cache from django.apps import app_cache
from django.dispatch import receiver from django.dispatch import receiver
from django.test.signals import setting_changed from django.test.signals import setting_changed
from django.utils.encoding import force_str, force_text from django.utils.encoding import force_str, force_text

View File

@ -4,8 +4,8 @@ import os
import gettext as gettext_module import gettext as gettext_module
from django import http from django import http
from django.apps import app_cache
from django.conf import settings from django.conf import settings
from django.core.apps import app_cache
from django.template import Context, Template from django.template import Context, Template
from django.utils.translation import check_for_language, to_locale, get_language from django.utils.translation import check_for_language, to_locale, get_language
from django.utils.encoding import smart_text from django.utils.encoding import smart_text

View File

@ -1,10 +1,10 @@
import unittest import unittest
from django.apps import app_cache
from django.conf import settings from django.conf import settings
from django.contrib.sites.models import Site from django.contrib.sites.models import Site
from django.contrib.admindocs import utils from django.contrib.admindocs import utils
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.core.apps import app_cache
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.test import TestCase from django.test import TestCase
from django.test.utils import override_settings from django.test.utils import override_settings

View File

@ -1,4 +1,4 @@
from django.core.apps.cache import AppCache from django.apps.cache import AppCache
from django.db import models from django.db import models
# We're testing app cache presence on load, so this is handy. # We're testing app cache presence on load, so this is handy.

View File

@ -1,7 +1,7 @@
from __future__ import absolute_import from __future__ import absolute_import
from django.core.apps import app_cache from django.apps import app_cache
from django.core.apps.cache import AppCache from django.apps.cache import AppCache
from django.db import models from django.db import models
from django.test import TestCase from django.test import TestCase

View File

@ -5,8 +5,8 @@ import sys
from unittest import TestCase from unittest import TestCase
import warnings import warnings
from django.core.apps import app_cache from django.apps import app_cache
from django.core.apps.cache import AppCache from django.apps.cache import AppCache
from django.test.utils import override_settings from django.test.utils import override_settings
from django.utils._os import upath from django.utils._os import upath
from django.utils import six from django.utils import six

View File

@ -5,7 +5,7 @@ import os
import sys import sys
import unittest import unittest
from django.core.apps import app_cache from django.apps import app_cache
from django.core.management import ManagementUtility from django.core.management import ManagementUtility
from django.utils.six import StringIO from django.utils.six import StringIO

View File

@ -1,6 +1,6 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from django.core.apps import app_cache from django.apps import app_cache
from django.core.management.color import no_style from django.core.management.color import no_style
from django.core.management.sql import (sql_create, sql_delete, sql_indexes, from django.core.management.sql import (sql_create, sql_delete, sql_indexes,
sql_destroy_indexes, sql_all) sql_destroy_indexes, sql_all)

View File

@ -1,8 +1,8 @@
from django.apps import app_cache
from django.conf import settings from django.conf import settings
from django.contrib import comments from django.contrib import comments
from django.contrib.comments.models import Comment from django.contrib.comments.models import Comment
from django.contrib.comments.forms import CommentForm from django.contrib.comments.forms import CommentForm
from django.core.apps import app_cache
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
from django.test.utils import override_settings from django.test.utils import override_settings
from django.utils import six from django.utils import six

View File

@ -1,7 +1,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from django.apps.cache import AppCache
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.core.apps.cache import AppCache
from django.db import models from django.db import models
from django.test import TestCase from django.test import TestCase

View File

@ -2,9 +2,9 @@ from __future__ import unicode_literals
from operator import attrgetter from operator import attrgetter
from django.apps import app_cache
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.contrib.sessions.backends.db import SessionStore from django.contrib.sessions.backends.db import SessionStore
from django.core.apps import app_cache
from django.db.models import Count from django.db.models import Count
from django.test import TestCase from django.test import TestCase
from django.test.utils import override_settings from django.test.utils import override_settings

View File

@ -8,8 +8,8 @@ import os
import pickle import pickle
from threading import local from threading import local
from django.apps import app_cache
from django.conf import settings from django.conf import settings
from django.core.apps import app_cache
from django.template import Template, Context from django.template import Template, Context
from django.template.base import TemplateSyntaxError from django.template.base import TemplateSyntaxError
from django.test import TestCase, RequestFactory from django.test import TestCase, RequestFactory

View File

@ -1,7 +1,7 @@
import sys import sys
import unittest import unittest
from django.core.apps import app_cache from django.apps import app_cache
from django.core.management.validation import get_validation_errors from django.core.management.validation import get_validation_errors
from django.test.utils import override_settings from django.test.utils import override_settings
from django.utils.six import StringIO from django.utils.six import StringIO

View File

@ -1,6 +1,6 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from django.core.apps import app_cache from django.apps import app_cache
from django.db import models from django.db import models
from django.template import Context, Template from django.template import Context, Template
from django.test import TestCase from django.test import TestCase

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from django.core.apps.cache import AppCache from django.apps.cache import AppCache
from django.db import models from django.db import models
from django.utils.encoding import python_2_unicode_compatible from django.utils.encoding import python_2_unicode_compatible

View File

@ -5,7 +5,7 @@ import codecs
import os import os
import shutil import shutil
from django.core.apps import app_cache from django.apps import app_cache
from django.core.management import call_command, CommandError from django.core.management import call_command, CommandError
from django.test.utils import override_settings from django.test.utils import override_settings
from django.utils import six from django.utils import six

View File

@ -1,4 +1,4 @@
from django.core.apps.cache import AppCache from django.apps.cache import AppCache
from django.db import models from django.db import models
from django.db.migrations.state import ProjectState, ModelState, InvalidBasesError from django.db.migrations.state import ProjectState, ModelState, InvalidBasesError
from django.test import TestCase from django.test import TestCase

View File

@ -5,7 +5,7 @@ from __future__ import unicode_literals
import datetime import datetime
import os import os
from django.core.apps import app_cache from django.apps import app_cache
from django.core.validators import RegexValidator, EmailValidator from django.core.validators import RegexValidator, EmailValidator
from django.db import models, migrations from django.db import models, migrations
from django.db.migrations.writer import MigrationWriter from django.db.migrations.writer import MigrationWriter

View File

@ -1,4 +1,4 @@
from django.core.apps import app_cache from django.apps import app_cache
from django.test import TestCase from django.test import TestCase

View File

@ -3,7 +3,7 @@ from __future__ import unicode_literals
import os import os
import sys import sys
from django.core.apps import app_cache from django.apps import app_cache
from django.core.management import call_command from django.core.management import call_command
from django.test import TestCase, TransactionTestCase from django.test import TestCase, TransactionTestCase
from django.utils._os import upath from django.utils._os import upath

View File

@ -1,9 +1,9 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from django.apps import app_cache
from django.contrib import admin from django.contrib import admin
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.core import management from django.core import management
from django.core.apps import app_cache
from django.core.exceptions import FieldError from django.core.exceptions import FieldError
from django.db import models, DEFAULT_DB_ALIAS from django.db import models, DEFAULT_DB_ALIAS
from django.db.models import signals from django.db.models import signals

View File

@ -80,14 +80,14 @@ def get_test_modules():
def get_installed(): def get_installed():
from django.core.apps import app_cache from django.apps import app_cache
return [app_config.name for app_config in app_cache.get_app_configs()] return [app_config.name for app_config in app_cache.get_app_configs()]
def setup(verbosity, test_labels): def setup(verbosity, test_labels):
import django import django
from django.apps import app_cache
from django.conf import settings from django.conf import settings
from django.core.apps import app_cache
from django.test import TransactionTestCase, TestCase from django.test import TransactionTestCase, TestCase
print("Testing against Django installed in '%s'" % os.path.dirname(django.__file__)) print("Testing against Django installed in '%s'" % os.path.dirname(django.__file__))

View File

@ -1,4 +1,4 @@
from django.core.apps.cache import AppCache from django.apps.cache import AppCache
from django.db import models from django.db import models
# Because we want to test creation and deletion of these as separate things, # Because we want to test creation and deletion of these as separate things,

View File

@ -2,9 +2,9 @@ from __future__ import unicode_literals
from django.utils.six import StringIO from django.utils.six import StringIO
from django.apps import app_cache
from django.contrib.auth.models import Permission from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.core.apps import app_cache
from django.core import management from django.core import management
from django.test import TestCase from django.test import TestCase
from django.test.utils import override_settings from django.test.utils import override_settings

View File

@ -1,7 +1,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from django.apps import app_cache
from django.conf import settings from django.conf import settings
from django.core.apps import app_cache
from django.db import connection from django.db import connection
from django.core.management.color import no_style from django.core.management.color import no_style
from django.test import TestCase, skipIfDBFeature, skipUnlessDBFeature from django.test import TestCase, skipIfDBFeature, skipUnlessDBFeature

View File

@ -20,7 +20,7 @@ except ImportError:
pkg_resources = None pkg_resources = None
from django.core.apps import app_cache from django.apps import app_cache
from django.template import TemplateDoesNotExist, Context from django.template import TemplateDoesNotExist, Context
from django.template.loaders.eggs import Loader as EggLoader from django.template.loaders.eggs import Loader as EggLoader
from django.template import loader from django.template import loader

View File

@ -16,7 +16,7 @@ import unittest
import warnings import warnings
from django import template from django import template
from django.core.apps import app_cache from django.apps import app_cache
from django.core import urlresolvers from django.core import urlresolvers
from django.template import (base as template_base, loader, Context, from django.template import (base as template_base, loader, Context,
RequestContext, Template, TemplateSyntaxError) RequestContext, Template, TemplateSyntaxError)

View File

@ -224,7 +224,7 @@ class ModulesTestsPackages(IgnoreAllDeprecationWarningsMixin, unittest.TestCase)
def test_get_tests(self): def test_get_tests(self):
"Check that the get_tests helper function can find tests in a directory" "Check that the get_tests helper function can find tests in a directory"
from django.core.apps.base import AppConfig from django.apps.base import AppConfig
from django.test.simple import get_tests from django.test.simple import get_tests
app_config = AppConfig.create('test_runner.valid_app') app_config = AppConfig.create('test_runner.valid_app')
app_config.import_models({}) app_config.import_models({})
@ -233,7 +233,7 @@ class ModulesTestsPackages(IgnoreAllDeprecationWarningsMixin, unittest.TestCase)
def test_import_error(self): def test_import_error(self):
"Test for #12658 - Tests with ImportError's shouldn't fail silently" "Test for #12658 - Tests with ImportError's shouldn't fail silently"
from django.core.apps.base import AppConfig from django.apps.base import AppConfig
from django.test.simple import get_tests from django.test.simple import get_tests
app_config = AppConfig.create('test_runner_invalid_app') app_config = AppConfig.create('test_runner_invalid_app')
app_config.import_models({}) app_config.import_models({})

View File

@ -1,6 +1,6 @@
import unittest import unittest
from django.core.apps import app_cache from django.apps import app_cache
from django.test.utils import IgnoreAllDeprecationWarningsMixin from django.test.utils import IgnoreAllDeprecationWarningsMixin

View File

@ -1,8 +1,8 @@
import os import os
from django import conf from django import conf
from django.apps import app_cache
from django.contrib import admin from django.contrib import admin
from django.core.apps import app_cache
from django.test import TestCase, override_settings from django.test import TestCase, override_settings
from django.utils.autoreload import gen_filenames from django.utils.autoreload import gen_filenames

View File

@ -5,7 +5,7 @@ import sys
import unittest import unittest
from zipimport import zipimporter from zipimport import zipimporter
from django.core.apps import app_cache from django.apps import app_cache
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
from django.test import SimpleTestCase from django.test import SimpleTestCase
from django.utils import six from django.utils import six

View File

@ -3,7 +3,7 @@ from __future__ import unicode_literals
import datetime import datetime
import unittest import unittest
from django.core.apps.cache import AppCache from django.apps.cache import AppCache
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.db import models from django.db import models
from django.test import TestCase from django.test import TestCase

View File

@ -4,8 +4,8 @@ import os
from os import path from os import path
import unittest import unittest
from django.apps import app_cache
from django.conf import settings from django.conf import settings
from django.core.apps import app_cache
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.test import LiveServerTestCase, TestCase from django.test import LiveServerTestCase, TestCase
from django.test.utils import override_settings from django.test.utils import override_settings