Comments updated

This commit is contained in:
Tomi Pajunen 2012-11-08 17:04:29 +02:00
parent b607eefc7c
commit 40c6fe7119
2 changed files with 3 additions and 3 deletions

View File

@ -6,7 +6,7 @@
## Master
* Bugfix: Cannot create objects with reversed M2M relations
* Bugfix: Cannot create objects with reverse M2M relations
## 2.1.1

View File

@ -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)