mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-11 04:07:39 +03:00
Less brittle through relationship testing. Closes #1292.
This commit is contained in:
parent
bc0e994784
commit
a439c80cd8
|
@ -713,7 +713,9 @@ class ModelSerializer(Serializer):
|
||||||
is_m2m = isinstance(relation.field,
|
is_m2m = isinstance(relation.field,
|
||||||
models.fields.related.ManyToManyField)
|
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
|
has_through_model = True
|
||||||
|
|
||||||
if nested:
|
if nested:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user