diff --git a/adrf/serializers.py b/adrf/serializers.py index 433925d..5648a44 100644 --- a/adrf/serializers.py +++ b/adrf/serializers.py @@ -272,7 +272,7 @@ async def acreate(self, validated_data): if many_to_many: for field_name, value in many_to_many.items(): field = getattr(instance, field_name) - field.set(value) + await field.aset(value) return instance @@ -298,6 +298,6 @@ async def aupdate(self, instance, validated_data): # updated instance and we do not want it to collide with .update() for attr, value in m2m_fields: field = getattr(instance, attr) - field.set(value) + await field.aset(value) return instance