mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-26 11:33:59 +03:00
Merge pull request #1217 from benpbenp/master
Fix object creation with reverse M2M when related_name unspecified
This commit is contained in:
commit
470134ae9b
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user