diff --git a/xadmin/plugins/xversion.py b/xadmin/plugins/xversion.py index 2a5cb5069..6e337a72b 100644 --- a/xadmin/plugins/xversion.py +++ b/xadmin/plugins/xversion.py @@ -204,7 +204,7 @@ def get(self, request, *args, **kwargs): return TemplateResponse( request, self.recover_list_template or self.get_template_list( - "views/recover_list.html"), + "views/recover_list.html"), context) diff --git a/xadmin/util.py b/xadmin/util.py index 06a23be82..dc60bef76 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 django.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: diff --git a/xadmin/views/base.py b/xadmin/views/base.py index a238b80ff..539ccbe4e 100644 --- a/xadmin/views/base.py +++ b/xadmin/views/base.py @@ -253,7 +253,7 @@ def __init__(self, request, *args, **kwargs): self.request = request self.request_method = request.method.lower() self.user = request.user - + self.base_plugins = [p(self) for p in getattr(self, "plugin_classes", [])] diff --git a/xadmin/views/dashboard.py b/xadmin/views/dashboard.py index 7aa9dafd5..fd1ea2255 100644 --- a/xadmin/views/dashboard.py +++ b/xadmin/views/dashboard.py @@ -36,7 +36,7 @@ def __init__(self, widgets, attrs=None): def render(self, name, value, attrs=None): if value is None: value = '' - final_attrs = self.build_attrs(attrs, name=name) + final_attrs = self.build_attrs(attrs, {'name':name}) final_attrs['class'] = 'nav nav-pills nav-stacked' output = [u'