From 68c88e180f1344bb641096276a23d5858aa065b9 Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Tue, 22 Sep 2015 15:55:39 +0200 Subject: [PATCH] Remove ContentType import fallback --- rest_framework/compat.py | 10 ---------- tests/test_relations_generic.py | 4 +++- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/rest_framework/compat.py b/rest_framework/compat.py index fcca2dcbf..e6039de5e 100644 --- a/rest_framework/compat.py +++ b/rest_framework/compat.py @@ -90,16 +90,6 @@ except ImportError: from django.db.models import get_model -# Import path changes from 1.7 onwards. -try: - from django.contrib.contenttypes.fields import ( - GenericForeignKey, GenericRelation - ) -except ImportError: - from django.contrib.contenttypes.generic import ( - GenericForeignKey, GenericRelation - ) - # django-filter is optional try: import django_filters diff --git a/tests/test_relations_generic.py b/tests/test_relations_generic.py index 5cb2dfc05..340d4d1d1 100644 --- a/tests/test_relations_generic.py +++ b/tests/test_relations_generic.py @@ -1,12 +1,14 @@ from __future__ import unicode_literals +from django.contrib.contenttypes.fields import ( + GenericForeignKey, GenericRelation +) from django.contrib.contenttypes.models import ContentType from django.db import models from django.test import TestCase from django.utils.encoding import python_2_unicode_compatible from rest_framework import serializers -from rest_framework.compat import GenericForeignKey, GenericRelation @python_2_unicode_compatible