Reload for prefetch_related
updates may fail if object is filtered out.
#4661
Labels
Milestone
prefetch_related
updates may fail if object is filtered out.
#4661
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 callrefresh_from_db
directly on the model instance. This means that we don't have a potential case ofget_object
returningNone
because the update itself has effectively removed the object from the base queryset causing the lookup to fail.The text was updated successfully, but these errors were encountered: