mirror of https://github.com/django/django.git
[3.1.x] Refs #31502 -- Made minor edits to Model._state docs.
Backport of 5ef6f62634
from master
This commit is contained in:
parent
54dce8148a
commit
e63644d37b
|
@ -101,10 +101,10 @@ Arguments sent with this signal:
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
``instance._state`` isn't set before sending the ``post_init`` signal,
|
:attr:`instance._state <django.db.models.Model._state>` isn't set
|
||||||
so ``_state`` attributes always have their default values. For example,
|
before sending the ``post_init`` signal, so ``_state`` attributes
|
||||||
``_state.db`` is ``None`` and cannot be used to check an ``instance``
|
always have their default values. For example, ``_state.db`` is
|
||||||
database.
|
``None``.
|
||||||
|
|
||||||
.. warning::
|
.. warning::
|
||||||
|
|
||||||
|
|
|
@ -239,9 +239,10 @@ database usage. Whenever a query needs to know which database to use,
|
||||||
it calls the master router, providing a model and a hint (if
|
it calls the master router, providing a model and a hint (if
|
||||||
available). Django then tries each router in turn until a database
|
available). Django then tries each router in turn until a database
|
||||||
suggestion can be found. If no suggestion can be found, it tries the
|
suggestion can be found. If no suggestion can be found, it tries the
|
||||||
current ``_state.db`` of the hint instance. If a hint instance wasn't
|
current :attr:`instance._state.db <django.db.models.Model._state>` of the hint
|
||||||
provided, or the instance doesn't currently have database state, the
|
instance. If a hint instance wasn't provided, or :attr:`instance._state.db
|
||||||
master router will allocate the ``default`` database.
|
<django.db.models.Model._state>` is ``None``, the master router will allocate
|
||||||
|
the ``default`` database.
|
||||||
|
|
||||||
An example
|
An example
|
||||||
----------
|
----------
|
||||||
|
|
Loading…
Reference in New Issue