Commit 40a84b85 authored by Jean-Baptiste Pasquier's avatar Jean-Baptiste Pasquier

fix: serializer can't bypass manager for m2m

parent a5d4899d
Pipeline #6766 passed with stage
in 1 minute and 29 seconds
......@@ -661,12 +661,12 @@ class LDPSerializer(HyperlinkedModelSerializer):
item_pk_to_keep = list(
map(lambda e: getattr(e, slug_field), filter(lambda x: hasattr(x, slug_field), data)))
for item in list(manager.all()):
if not str(getattr(item, slug_field)) in item_pk_to_keep:
if getattr(manager, 'through', None) is None:
if getattr(manager, 'through', None) is None:
for item in list(manager.all()):
if not str(getattr(item, slug_field)) in item_pk_to_keep:
item.delete()
else:
manager.remove(item)
else:
manager.clear()
for item in data:
if not isinstance(item, dict):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment