diff options
| author | Tom Christie | 2013-12-21 21:21:53 +0000 |
|---|---|---|
| committer | Tom Christie | 2013-12-21 21:21:53 +0000 |
| commit | a439c80cd856f0661cb66003263c454c5108fe0b (patch) | |
| tree | 7168ef7cb959f4762156a6c1c142dc26b00142bd /rest_framework/serializers.py | |
| parent | bc0e994784f46330b4e849c3326fbd5c500298b3 (diff) | |
| download | django-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.py | 4 |
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: |
