1
0
mirror of https://github.com/django/django.git synced 2025-07-04 17:59:13 +00:00

[2.2.x] Refs #30083 -- Clarified database state of instances in signals.pre_init docs.

Backport of a2e1c17f193f5017e1f6fac7d860f1f9e34d7892 from master
This commit is contained in:
Mariusz Felisiak 2019-07-19 13:02:57 +02:00
parent de2635fb4e
commit fa3ae446d9

View File

@ -99,6 +99,13 @@ Arguments sent with this signal:
``instance`` ``instance``
The actual instance of the model that's just been created. The actual instance of the model that's just been created.
.. 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.
``pre_save`` ``pre_save``
------------ ------------