parent
d4fd31684a
commit
a8c15481f4
|
@ -18,7 +18,7 @@ class Apps:
|
|||
"""
|
||||
|
||||
def __init__(self, installed_apps=()):
|
||||
# installed_apps is set to None when creating the master registry
|
||||
# installed_apps is set to None when creating the main registry
|
||||
# because it cannot be populated at that point. Other registries must
|
||||
# provide a list of installed apps and are populated immediately.
|
||||
if installed_apps is None and hasattr(sys.modules[__name__], "apps"):
|
||||
|
@ -54,7 +54,7 @@ class Apps:
|
|||
# `lazy_model_operation()` and `do_pending_operations()` methods.
|
||||
self._pending_operations = defaultdict(list)
|
||||
|
||||
# Populate apps and models, unless it's the master registry.
|
||||
# Populate apps and models, unless it's the main registry.
|
||||
if installed_apps is not None:
|
||||
self.populate(installed_apps)
|
||||
|
||||
|
|
|
@ -785,7 +785,7 @@ class Client(ClientMixin, RequestFactory):
|
|||
|
||||
def request(self, **request):
|
||||
"""
|
||||
The master request method. Compose the environment dictionary and pass
|
||||
Make a generic request. Compose the environment dictionary and pass
|
||||
to the handler, return the result of the handler. Assume defaults for
|
||||
the query environment, which can be overridden using the arguments to
|
||||
the request.
|
||||
|
@ -1041,7 +1041,7 @@ class AsyncClient(ClientMixin, AsyncRequestFactory):
|
|||
|
||||
async def request(self, **request):
|
||||
"""
|
||||
The master request method. Compose the scope dictionary and pass to the
|
||||
Make a generic request. Compose the scope dictionary and pass to the
|
||||
handler, return the result of the handler. Assume defaults for the
|
||||
query environment, which can be overridden using the arguments to the
|
||||
request.
|
||||
|
|
|
@ -94,8 +94,8 @@ source_suffix = ".txt"
|
|||
# The encoding of source files.
|
||||
# source_encoding = 'utf-8-sig'
|
||||
|
||||
# The master toctree document.
|
||||
master_doc = "contents"
|
||||
# The root document.
|
||||
root_doc = "contents"
|
||||
|
||||
# General substitutions.
|
||||
project = "Django"
|
||||
|
@ -347,7 +347,7 @@ man_pages = [
|
|||
# description, category, toctree_only)
|
||||
texinfo_documents = [
|
||||
(
|
||||
master_doc,
|
||||
root_doc,
|
||||
"django",
|
||||
"",
|
||||
"",
|
||||
|
|
|
@ -870,9 +870,9 @@ If you\(aqre in a multi\-database setup, you might have fixture data that
|
|||
you want to load onto one database, but not onto another. In this
|
||||
situation, you can add a database identifier into the names of your fixtures.
|
||||
.sp
|
||||
For example, if your \fBDATABASES\fP setting has a \(aqmaster\(aq database
|
||||
defined, name the fixture \fBmydata.master.json\fP or
|
||||
\fBmydata.master.json.gz\fP and the fixture will only be loaded when you
|
||||
For example, if your \fBDATABASES\fP setting has a \(aqusers\(aq database
|
||||
defined, name the fixture \fBmydata.users.json\fP or
|
||||
\fBmydata.users.json.gz\fP and the fixture will only be loaded when you
|
||||
specify you want to load data into the \fBmaster\fP database.
|
||||
.SS Loading fixtures from \fBstdin\fP
|
||||
.sp
|
||||
|
@ -1815,7 +1815,7 @@ zip files, you can use a URL like:
|
|||
.sp
|
||||
.nf
|
||||
.ft C
|
||||
django\-admin startapp \-\-template=https://github.com/githubuser/django\-app\-template/archive/master.zip myapp
|
||||
django\-admin startapp \-\-template=https://github.com/githubuser/django\-app\-template/archive/main.zip myapp
|
||||
.ft P
|
||||
.fi
|
||||
.UNINDENT
|
||||
|
|
|
@ -18,9 +18,9 @@ MRO is an acronym for Method Resolution Order.
|
|||
|
||||
.. class:: django.views.generic.base.View
|
||||
|
||||
The master class-based base view. All other class-based views inherit from
|
||||
this base class. It isn't strictly a generic view and thus can also be
|
||||
imported from ``django.views``.
|
||||
The base view class. All other class-based views inherit from this base
|
||||
class. It isn't strictly a generic view and thus can also be imported from
|
||||
``django.views``.
|
||||
|
||||
**Method Flowchart**
|
||||
|
||||
|
|
|
@ -632,10 +632,10 @@ If you're in a multi-database setup, you might have fixture data that
|
|||
you want to load onto one database, but not onto another. In this
|
||||
situation, you can add a database identifier into the names of your fixtures.
|
||||
|
||||
For example, if your :setting:`DATABASES` setting has a 'master' database
|
||||
defined, name the fixture ``mydata.master.json`` or
|
||||
``mydata.master.json.gz`` and the fixture will only be loaded when you
|
||||
specify you want to load data into the ``master`` database.
|
||||
For example, if your :setting:`DATABASES` setting has a 'users' database
|
||||
defined, name the fixture ``mydata.users.json`` or
|
||||
``mydata.users.json.gz`` and the fixture will only be loaded when you
|
||||
specify you want to load data into the ``users`` database.
|
||||
|
||||
.. _loading-fixtures-stdin:
|
||||
|
||||
|
@ -1311,7 +1311,7 @@ fly.
|
|||
For example, taking advantage of GitHub's feature to expose repositories as
|
||||
zip files, you can use a URL like::
|
||||
|
||||
django-admin startapp --template=https://github.com/githubuser/django-app-template/archive/master.zip myapp
|
||||
django-admin startapp --template=https://github.com/githubuser/django-app-template/archive/main.zip myapp
|
||||
|
||||
.. django-admin-option:: --extension EXTENSIONS, -e EXTENSIONS
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
pyenchant
|
||||
Sphinx>=3.1.0
|
||||
Sphinx>=4.0.0
|
||||
sphinxcontrib-spelling
|
||||
|
|
|
@ -233,18 +233,18 @@ Using routers
|
|||
|
||||
Database routers are installed using the :setting:`DATABASE_ROUTERS`
|
||||
setting. This setting defines a list of class names, each specifying a
|
||||
router that should be used by the master router
|
||||
router that should be used by the base router
|
||||
(``django.db.router``).
|
||||
|
||||
The master router is used by Django's database operations to allocate
|
||||
The base router is used by Django's database operations to allocate
|
||||
database usage. Whenever a query needs to know which database to use,
|
||||
it calls the master router, providing a model and a hint (if
|
||||
available). Django then tries each router in turn until a database
|
||||
suggestion can be found. If no suggestion can be found, it tries the
|
||||
current :attr:`instance._state.db <django.db.models.Model._state>` of the hint
|
||||
instance. If a hint instance wasn't provided, or :attr:`instance._state.db
|
||||
<django.db.models.Model._state>` is ``None``, the master router will allocate
|
||||
the ``default`` database.
|
||||
it calls the base router, providing a model and a hint (if
|
||||
available). The base router tries each router class in turn until one returns
|
||||
a database suggestion. If no routers return a suggestion, the base router tries
|
||||
the current :attr:`instance._state.db
|
||||
<django.db.models.Model._state>` of the hint instance. If no hint instance
|
||||
was provided, or :attr:`instance._state.db <django.db.models.Model._state>` is
|
||||
``None``, the base router will allocate the ``default`` database.
|
||||
|
||||
An example
|
||||
----------
|
||||
|
|
|
@ -33,20 +33,20 @@ HERE = os.path.dirname(__file__)
|
|||
|
||||
|
||||
class AppsTests(SimpleTestCase):
|
||||
def test_singleton_master(self):
|
||||
def test_singleton_main(self):
|
||||
"""
|
||||
Only one master registry can exist.
|
||||
Only one main registry can exist.
|
||||
"""
|
||||
with self.assertRaises(RuntimeError):
|
||||
Apps(installed_apps=None)
|
||||
|
||||
def test_ready(self):
|
||||
"""
|
||||
Tests the ready property of the master registry.
|
||||
Tests the ready property of the main registry.
|
||||
"""
|
||||
# The master app registry is always ready when the tests run.
|
||||
# The main app registry is always ready when the tests run.
|
||||
self.assertIs(apps.ready, True)
|
||||
# Non-master app registries are populated in __init__.
|
||||
# Non-main app registries are populated in __init__.
|
||||
self.assertIs(Apps().ready, True)
|
||||
# The condition is set when apps are ready
|
||||
self.assertIs(apps.ready_event.is_set(), True)
|
||||
|
|
|
@ -173,7 +173,7 @@ class LiveServerViews(LiveServerBase):
|
|||
we can detect a content length from the response. This should be doable
|
||||
for all simple views and streaming responses where an iterable with
|
||||
length of one is passed. The latter follows as result of `set_content_length`
|
||||
from https://github.com/python/cpython/blob/master/Lib/wsgiref/handlers.py.
|
||||
from https://github.com/python/cpython/blob/main/Lib/wsgiref/handlers.py.
|
||||
|
||||
If we cannot detect a content length we explicitly set the `Connection`
|
||||
header to `close` to notify the client that we do not actually support
|
||||
|
|
|
@ -1778,7 +1778,7 @@ class OverrideSettingsTests(SimpleTestCase):
|
|||
|
||||
def test_override_database_routers(self):
|
||||
"""
|
||||
Overriding DATABASE_ROUTERS should update the master router.
|
||||
Overriding DATABASE_ROUTERS should update the base router.
|
||||
"""
|
||||
test_routers = [object()]
|
||||
with self.settings(DATABASE_ROUTERS=test_routers):
|
||||
|
|
Loading…
Reference in New Issue