Less brittle through relationship testing. Closes #1292.

This commit is contained in:
Tom Christie 2013-12-21 21:21:53 +00:00
parent bc0e994784
commit a439c80cd8

View File

@ -713,7 +713,9 @@ class ModelSerializer(Serializer):
is_m2m = isinstance(relation.field,
models.fields.related.ManyToManyField)
if is_m2m and not relation.field.rel.through._meta.auto_created:
if (is_m2m and
hasattr(relation.field.rel, 'through') and
not relation.field.rel.through._meta.auto_created):
has_through_model = True
if nested: