#31475: Recursion issue when deleting related objects
-------------------------------------+-------------------------------------
     Reporter:  Matt Drew            |                    Owner:  nobody
         Type:  Bug                  |                   Status:  closed
    Component:  Database layer       |                  Version:  3.0
  (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
-------------------------------------+-------------------------------------
Changes (by Simon Charette):

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


Comment:

 Duplicate of #31435.

 In short your code never supported field deferring and was causing silent
 queries on model initialization.

 e.g.

 {{{#!python
 list(ClassB.objects.only('pk'))
 }}}

 Was causing `2N+1` database queries where `N = ClassB.objects.count()`.

 There's more details in the linked issue but you should be overriding
 `from_db` to achieve this purpose or use `self.__dict__.get` to account
 for the fact the field might be deferred.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31475#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 on the web visit 
https://groups.google.com/d/msgid/django-updates/065.8a312e4d07bf04349e20029cd3ca9644%40djangoproject.com.

Reply via email to