Skip to content

Commit 9926241

Browse files
committed
Merge pull request #2857 from w-/patch-3
increase serializer compatibility to django 1.8
2 parents 91ba271 + ee109c4 commit 9926241

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

rest_framework/serializers.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -993,7 +993,11 @@ def restore_object(self, attrs, instance=None):
993993
m2m_data[field_name] = attrs.pop(field_name)
994994

995995
# Forward m2m relations
996-
for field in meta.many_to_many + meta.virtual_fields:
996+
if issubclass(meta.many_to_many.__class__, tuple):
997+
temp_m2m = list(meta.many_to_many)
998+
else:
999+
temp_m2m = meta.many_to_many
1000+
for field in temp_m2m + meta.virtual_fields:
9971001
if isinstance(field, GenericForeignKey):
9981002
continue
9991003
if field.name in attrs:

0 commit comments

Comments
 (0)