[compat] Remove PY2 compat artefacts

- No need to specific types
- Remove __future__ imports
This commit is contained in:
Bastien Vallet
2020-08-04 14:43:07 +02:00
parent 85469082d0
commit 68605ba2ba
13 changed files with 9 additions and 58 deletions
+3 -15
View File
@@ -1,8 +1,6 @@
"""
The parent admin displays the list view of the base model.
"""
import sys
from django.contrib import admin
from django.contrib.admin.helpers import AdminErrorList, AdminForm
from django.contrib.admin.templatetags.admin_urls import add_preserved_filters
@@ -11,6 +9,7 @@ from django.core.exceptions import ImproperlyConfigured, PermissionDenied
from django.db import models
from django.http import Http404, HttpResponseRedirect
from django.template.response import TemplateResponse
from django.urls import URLResolver
from django.utils.encoding import force_text
from django.utils.http import urlencode
from django.utils.safestring import mark_safe
@@ -20,17 +19,6 @@ from polymorphic.utils import get_base_polymorphic_model
from .forms import PolymorphicModelChoiceForm
try:
# Django 2.0+
from django.urls import URLResolver
except ImportError:
# Django < 2.0
from django.urls import RegexURLResolver as URLResolver
if sys.version_info[0] >= 3:
long = int
class RegistrationClosed(RuntimeError):
"The admin model can't be registered anymore at this point."
@@ -293,9 +281,9 @@ class PolymorphicParentModelAdmin(admin.ModelAdmin):
try:
pos = path.find("/")
if pos == -1:
object_id = long(path)
object_id = int(path)
else:
object_id = long(path[0:pos])
object_id = int(path[0:pos])
except ValueError:
raise Http404(
"No ct_id parameter, unable to find admin subclass for path '{0}'.".format(