aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/serializers.py
diff options
context:
space:
mode:
authorTom Christie2013-12-21 21:21:53 +0000
committerTom Christie2013-12-21 21:21:53 +0000
commita439c80cd856f0661cb66003263c454c5108fe0b (patch)
tree7168ef7cb959f4762156a6c1c142dc26b00142bd /rest_framework/serializers.py
parentbc0e994784f46330b4e849c3326fbd5c500298b3 (diff)
downloaddjango-rest-framework-a439c80cd856f0661cb66003263c454c5108fe0b.tar.bz2
Less brittle through relationship testing. Closes #1292.
Diffstat (limited to 'rest_framework/serializers.py')
-rw-r--r--rest_framework/serializers.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/rest_framework/serializers.py b/rest_framework/serializers.py
index 28a09880..8351b3df 100644
--- a/rest_framework/serializers.py
+++ b/rest_framework/serializers.py
@@ -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: