mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-01-23 15:54:16 +03:00
Comments updated
This commit is contained in:
parent
b607eefc7c
commit
40c6fe7119
|
@ -6,7 +6,7 @@
|
|||
|
||||
## Master
|
||||
|
||||
* Bugfix: Cannot create objects with reversed M2M relations
|
||||
* Bugfix: Cannot create objects with reverse M2M relations
|
||||
|
||||
## 2.1.1
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user