From 40c6fe7119e724d86f40b202c0dd579ad7ce8c7e Mon Sep 17 00:00:00 2001 From: Tomi Pajunen Date: Thu, 8 Nov 2012 17:04:29 +0200 Subject: [PATCH] Comments updated --- docs/topics/release-notes.md | 2 +- rest_framework/serializers.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/topics/release-notes.md b/docs/topics/release-notes.md index 302ad8b39..47252b652 100644 --- a/docs/topics/release-notes.md +++ b/docs/topics/release-notes.md @@ -6,7 +6,7 @@ ## Master -* Bugfix: Cannot create objects with reversed M2M relations +* Bugfix: Cannot create objects with reverse M2M relations ## 2.1.1 diff --git a/rest_framework/serializers.py b/rest_framework/serializers.py index e45016799..95145d580 100644 --- a/rest_framework/serializers.py +++ b/rest_framework/serializers.py @@ -447,13 +447,13 @@ class ModelSerializer(Serializer): setattr(instance, key, val) return instance - # Reversed relation + # Reverse relations for (obj, model) in self.opts.model._meta.get_all_related_m2m_objects_with_model(): field_name = obj.field.related_query_name() if field_name in attrs: self.m2m_data[field_name] = attrs.pop(field_name) - # Forward relation + # Forward relations for field in self.opts.model._meta.many_to_many: if field.name in attrs: self.m2m_data[field.name] = attrs.pop(field.name)