From 7aec57cb076f83e07bbfb0a7edb257e531c66000 Mon Sep 17 00:00:00 2001 From: wgbbiao Date: Wed, 7 Jun 2017 16:00:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9django=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- xadmin/util.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/xadmin/util.py b/xadmin/util.py index 06a23be82..1a04e604f 100644 --- a/xadmin/util.py +++ b/xadmin/util.py @@ -16,6 +16,7 @@ from django.forms import Media from django.utils.translation import get_language from django.contrib.admin.utils import label_for_field, help_text_for_field +from django import VERSION as version import datetime import decimal @@ -34,7 +35,7 @@ except ImportError: from django.utils.timezone import localtime as tz_localtime -if django.get_version() < '1.11': +if version[1] < 11: DJANGO_11 = False else: DJANGO_11 = True @@ -292,7 +293,7 @@ def lookup_field(name, obj, model_admin=None): model_admin is not None and hasattr(model_admin, name) and name not in ('__str__', '__unicode__') - ): + ): attr = getattr(model_admin, name) value = attr(obj) else: