Merge pull request #1217 from benpbenp/master

Fix object creation with reverse M2M when related_name unspecified
This commit is contained in:
Tom Christie 2013-11-08 07:15:40 -08:00
commit 470134ae9b

View File

@ -878,7 +878,7 @@ class ModelSerializer(Serializer):
# Reverse m2m relations
for (obj, model) in meta.get_all_related_m2m_objects_with_model():
field_name = obj.field.related_query_name()
field_name = obj.get_accessor_name()
if field_name in attrs:
m2m_data[field_name] = attrs.pop(field_name)