#36372: refresh_from_db with explicit fields can't clear a relation by it's 
query
name unless it's prefetched
-------------------------------------+-------------------------------------
     Reporter:  Roman Donchenko      |                    Owner:  (none)
         Type:  Bug                  |                   Status:  closed
    Component:  Database layer       |                  Version:  5.2
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:  wontfix
     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 Sarah Boyce):

 * resolution:   => wontfix
 * status:  new => closed
 * summary:
     refresh_from_db with explicit fields can't clear a relation unless
     it's prefetched
     =>
     refresh_from_db with explicit fields can't clear a relation by it's
     query name unless it's prefetched

Comment:

 Thank you Simon
 Confirmed that adding `related_name="items"` and calling
 `refresh_from_db(fields=["items"])` doesn't crash


 > Changing ForeignObjectRel.name to default to .accessor_name is tempting
 here but that would likely break tons of things.

 As this can be resolved on the model level, I will close this as wontfix
 for now.
 If we receive a non-invasive fix to support this, I think we would be open
 to accepting a patch
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36372#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/01070196c38c8b50-176caf89-c81f-40a8-b10a-4ed232c7f8d2-000000%40eu-central-1.amazonses.com.

Reply via email to