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