Reverted int/long change, as Django's BigIntegerField can produce longs on Python 2

fix_request_path_info
Diederik van der Boor 2017-07-10 10:57:07 +02:00
parent e5d21d7b4e
commit 67dd5c0a0d
1 changed files with 7 additions and 2 deletions

View File

@ -1,6 +1,7 @@
""" """
The parent admin displays the list view of the base model. The parent admin displays the list view of the base model.
""" """
import sys
import warnings import warnings
import django import django
@ -21,6 +22,10 @@ from django.utils.translation import ugettext_lazy as _
from .forms import PolymorphicModelChoiceForm from .forms import PolymorphicModelChoiceForm
if sys.version_info[0] >= 3:
long = int
class RegistrationClosed(RuntimeError): class RegistrationClosed(RuntimeError):
"The admin model can't be registered anymore at this point." "The admin model can't be registered anymore at this point."
@ -315,9 +320,9 @@ class PolymorphicParentModelAdmin(admin.ModelAdmin):
try: try:
pos = path.find('/') pos = path.find('/')
if pos == -1: if pos == -1:
object_id = int(path) object_id = long(path)
else: else:
object_id = int(path[0:pos]) object_id = long(path[0:pos])
except ValueError: except ValueError:
raise Http404("No ct_id parameter, unable to find admin subclass for path '{0}'.".format(path)) raise Http404("No ct_id parameter, unable to find admin subclass for path '{0}'.".format(path))