Skip to content

Commit 7d8c951

Browse files
author
kazmiruk
committed
remove list\tuple changes from PR
1 parent e3522e8 commit 7d8c951

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

rest_framework/serializers.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -992,15 +992,12 @@ def restore_object(self, attrs, instance=None):
992992
if field_name in attrs:
993993
m2m_data[field_name] = attrs.pop(field_name)
994994

995-
def _inner_loop_code(field):
995+
# Forward m2m relations
996+
for field in meta.many_to_many + meta.virtual_fields:
996997
if isinstance(field, GenericForeignKey):
997-
return
998+
continue
998999
if field.name in attrs:
999-
m2m_data[field.name] = attrs.pop(field.name)
1000-
1001-
# Forward m2m relations
1002-
[_inner_loop_code(field) for field in meta.many_to_many]
1003-
[_inner_loop_code(field) for field in meta.virtual_fields]
1000+
m2m_data[field.name] = attrs.pop(field.name)
10041001

10051002
# Nested forward relations - These need to be marked so we can save
10061003
# them before saving the parent model instance.

0 commit comments

Comments
 (0)