mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-02 20:54:42 +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,
|
||||
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:
|
||||
|
|
Loading…
Reference in New Issue
Block a user