diff options
author | Adam Johnson <me@adamj.eu> | 2020-07-15 10:27:46 +0100 |
---|---|---|
committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-07-16 21:12:33 +0200 |
commit | 051e6f58ea0260a99e3b96e5d2ad5d39f51e4a7b (patch) | |
tree | d5af73f8e5aacbb998c5629eeb75c46dcd935d32 | |
parent | 331324ecce1330dce3dbd1713203cb9a42854ad7 (diff) | |
download | django-051e6f58ea0260a99e3b96e5d2ad5d39f51e4a7b.tar.gz |
[3.0.x] Refs #31502 -- Made minor edits to Model._state docs.
Backport of 5ef6f626347f9ea13915f3cf5b8b045c5b42b102 from master
-rw-r--r-- | docs/ref/signals.txt | 8 | ||||
-rw-r--r-- | docs/topics/db/multi-db.txt | 7 |
2 files changed, 8 insertions, 7 deletions
diff --git a/docs/ref/signals.txt b/docs/ref/signals.txt index dc8c53ac2d..a4ed248769 100644 --- a/docs/ref/signals.txt +++ b/docs/ref/signals.txt @@ -101,10 +101,10 @@ Arguments sent with this signal: .. note:: - ``instance._state`` isn't set before sending the ``post_init`` signal, - so ``_state`` attributes always have their default values. For example, - ``_state.db`` is ``None`` and cannot be used to check an ``instance`` - database. + :attr:`instance._state <django.db.models.Model._state>` isn't set + before sending the ``post_init`` signal, so ``_state`` attributes + always have their default values. For example, ``_state.db`` is + ``None``. .. warning:: diff --git a/docs/topics/db/multi-db.txt b/docs/topics/db/multi-db.txt index be660cfcc2..afd6e28acc 100644 --- a/docs/topics/db/multi-db.txt +++ b/docs/topics/db/multi-db.txt @@ -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 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 ``_state.db`` of the hint instance. If a hint instance wasn't -provided, or the instance doesn't currently have database state, the -master router will allocate the ``default`` database. +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. An example ---------- |