Skip to content

Reload for prefetch_related updates may fail if object is filtered out. #4661

@tomchristie

Description

@tomchristie

In the awkward case where prefetch_related has been applied to an update operation, we are required to refresh the instance from the database (see #4553)

The current implementation re-calls get_object(). We should instead call refresh_from_db directly on the model instance. This means that we don't have a potential case of get_object returning None because the update itself has effectively removed the object from the base queryset causing the lookup to fail.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy