#36713: RecursionError with only() and fields usage in __init__
-------------------------------+--------------------------------------
     Reporter:  Michal Čihař   |                    Owner:  (none)
         Type:  Uncategorized  |                   Status:  closed
    Component:  Uncategorized  |                  Version:  5.2
     Severity:  Normal         |               Resolution:  invalid
     Keywords:                 |             Triage Stage:  Unreviewed
    Has patch:  0              |      Needs documentation:  0
  Needs tests:  0              |  Patch needs improvement:  0
Easy pickings:  0              |                    UI/UX:  0
-------------------------------+--------------------------------------
Changes (by Simon Charette):

 * resolution:   => invalid
 * status:  new => closed

Comment:

 Please
 
[https://docs.djangoproject.com/en/5.2/ref/models/instances/#django.db.models.Model
 refer to the documentation] about `Model.__init__` and the note about
 overriding it

 > 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.
 **Additionally, referring to model fields within `__init__` may
 potentially result in infinite recursion errors in some circumstances**.

 You can refer to #31435 for some discussion on the subject but the TL;DR
 is that your `__init__` override **must** account for some fields being
 potentially deferred.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36713#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/0107019a59686867-80936de5-2e8b-4a29-8760-9a86070dae45-000000%40eu-central-1.amazonses.com.

Reply via email to