Skip to content

Commit 7eecf38

Browse files
author
Jakub Dorňák
committed
test polymorphic.__version__ to determine the api of get_child_type_choices
1 parent cbbf2e0 commit 7eecf38

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

polymorphic_tree/admin/parentadmin.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import json, django
22
from future.builtins import str, int
3+
from distutils.version import StrictVersion
34
from django.conf import settings
45
from django.core.urlresolvers import reverse
56
from django.db import transaction
67
from django.http import HttpResponseNotFound, HttpResponse, HttpResponseBadRequest, HttpResponseRedirect
78
from django.utils.translation import ugettext_lazy as _
9+
from polymorphic.__version__ import __version__ as polymorphic_version
810
from polymorphic.admin import PolymorphicParentModelAdmin, PolymorphicModelChoiceForm
911
from polymorphic_tree.models import PolymorphicMPTTModel
1012
from mptt.admin import MPTTModelAdmin
@@ -38,7 +40,7 @@ class NodeTypeListFilter(SimpleListFilter):
3840
title = _('node type')
3941

4042
def lookups(self, request, model_admin):
41-
if django.VERSION >= (1, 6):
43+
if StrictVersion(polymorphic_version) >= StrictVersion('0.6'):
4244
return model_admin.get_child_type_choices(request, 'change')
4345
return model_admin.get_child_type_choices()
4446

0 commit comments

Comments
 (0)