Merge pull request #2857 from w-/patch-3

increase serializer compatibility to django 1.8
This commit is contained in:
Xavier Ordoquy 2015-05-04 15:56:58 +02:00
commit 9926241afb

View File

@ -993,7 +993,11 @@ class ModelSerializer(Serializer):
m2m_data[field_name] = attrs.pop(field_name)
# Forward m2m relations
for field in meta.many_to_many + meta.virtual_fields:
if issubclass(meta.many_to_many.__class__, tuple):
temp_m2m = list(meta.many_to_many)
else:
temp_m2m = meta.many_to_many
for field in temp_m2m + meta.virtual_fields:
if isinstance(field, GenericForeignKey):
continue
if field.name in attrs: