#36344: Accessing a related field after using defer() or only() unexpectedly
overwrites unsaved state on model instances
-------------------------------------+-------------------------------------
     Reporter:  Erick                |                    Owner:  (none)
         Type:  Uncategorized        |                   Status:  closed
    Component:  Database layer       |                  Version:  5.2
  (models, ORM)                      |
     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
-------------------------------------+-------------------------------------
Comment (by Erick):

 That makes sense, appreciate the explanation. I wonder if it would be
 reasonable to update the docs to mention this bad behavior; as written, I
 would have passed off the admonition about __init__ as probably not
 related given that it just talks about infinite recursion.

 > Additionally, referring to model fields within __init__ may potentially
 result in infinite recursion errors in some circumstances.

 Happy to contribute a PR if you think it's a good idea.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36344#comment:4>
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/010701965e18873e-2c154827-8ca6-4dba-93fc-298cb4cf40b8-000000%40eu-central-1.amazonses.com.

Reply via email to