mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-04 12:30:11 +03:00
refresh prefecth cache after saving data
This commit is contained in:
parent
5d674927b8
commit
b7a03d56d9
|
@ -1014,6 +1014,9 @@ class ModelSerializer(Serializer):
|
|||
if getattr(obj, '_m2m_data', None):
|
||||
for accessor_name, object_list in obj._m2m_data.items():
|
||||
setattr(obj, accessor_name, object_list)
|
||||
if hasattr(obj, '_prefetched_objects_cache')\
|
||||
and accessor_name in obj._prefetched_objects_cache:
|
||||
obj._prefetched_objects_cache[accessor_name] = object_list
|
||||
del(obj._m2m_data)
|
||||
|
||||
if getattr(obj, '_related_data', None):
|
||||
|
|
Loading…
Reference in New Issue
Block a user