diff options
| author | David Sanders <shang.xiao.sanders@gmail.com> | 2023-09-19 18:07:22 +1000 |
|---|---|---|
| committer | Natalia <124304+nessita@users.noreply.github.com> | 2023-10-05 14:34:07 -0300 |
| commit | 66978802196da4ec1e4b6bf9b1094136e9c16abf (patch) | |
| tree | c0e62591e714e68129184c331751db15cfb30095 | |
| parent | a9a3317a95fe25ac1f85dc5f6a9e525f02014c99 (diff) | |
[4.2.x] Refs #31435 -- Doc'd potential infinite recursion when accessing model fields in __init__.
Backport of e47298aec4fa04416e7082331fbd44bd9f2662aa from main
| -rw-r--r-- | docs/ref/models/instances.txt | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/docs/ref/models/instances.txt b/docs/ref/models/instances.txt index 8d2aa637f2..deb2c8d8ee 100644 --- a/docs/ref/models/instances.txt +++ b/docs/ref/models/instances.txt @@ -30,7 +30,9 @@ need to :meth:`~Model.save()`. You may be tempted to customize the model by overriding the ``__init__`` method. If you do so, however, take care not to change the calling signature as any change may prevent the model instance from being saved. - Rather than overriding ``__init__``, try using one of these approaches: + Additionally, referring to model fields within ``__init__`` may potentially + result in infinite recursion errors in some circumstances. Rather than + overriding ``__init__``, try using one of these approaches: #. Add a classmethod on the model class:: |
