From 74e0c924558baa9f19d59b94cf89168cfc606085 Mon Sep 17 00:00:00 2001 From: Jaap Roes Date: Thu, 16 Mar 2017 14:22:27 +0100 Subject: [PATCH] Remove contenttypes.generic import fallbacks --- adminsortable/admin.py | 11 ++--------- sample_project/app/models.py | 8 +------- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/adminsortable/admin.py b/adminsortable/admin.py index 9bf089a..d233f58 100644 --- a/adminsortable/admin.py +++ b/adminsortable/admin.py @@ -6,15 +6,8 @@ from django.conf import settings from django.conf.urls import url from django.contrib.admin import ModelAdmin, TabularInline, StackedInline from django.contrib.admin.options import InlineModelAdmin - -try: - from django.contrib.contenttypes.admin import (GenericStackedInline, - GenericTabularInline) -except: - # Django < 1.7 - from django.contrib.contenttypes.generic import (GenericStackedInline, - GenericTabularInline) - +from django.contrib.contenttypes.admin import (GenericStackedInline, + GenericTabularInline) from django.contrib.contenttypes.models import ContentType from django.core.exceptions import PermissionDenied from django.http import HttpResponse, Http404 diff --git a/sample_project/app/models.py b/sample_project/app/models.py index 6f1186f..81e6606 100644 --- a/sample_project/app/models.py +++ b/sample_project/app/models.py @@ -1,10 +1,4 @@ -from django import VERSION - -if VERSION < (1, 9): - from django.contrib.contenttypes.generic import GenericForeignKey -else: - from django.contrib.contenttypes.fields import GenericForeignKey - +from django.contrib.contenttypes.fields import GenericForeignKey from django.contrib.contenttypes.models import ContentType from django.db import models from django.utils.encoding import python_2_unicode_compatible