From 8a513f4dc541b5ec0c0a8f6714ff7a52fc6dd079 Mon Sep 17 00:00:00 2001 From: Dmitry Kalinin Date: Fri, 11 Sep 2020 11:07:24 +0300 Subject: [PATCH] Support Django 3 --- jet/dashboard/models.py | 5 ++++- jet/dashboard/templates/admin/index.html | 2 +- jet/models.py | 5 ++++- jet/templates/admin/edit_inline/compact.html | 2 +- jet/templates/rangefilter/date_filter.html | 2 +- jet/tests/models.py | 5 ++++- 6 files changed, 15 insertions(+), 6 deletions(-) diff --git a/jet/dashboard/models.py b/jet/dashboard/models.py index cf43c30c..54549bdf 100644 --- a/jet/dashboard/models.py +++ b/jet/dashboard/models.py @@ -1,10 +1,13 @@ from importlib import import_module import json from django.db import models -from django.utils.encoding import python_2_unicode_compatible from django.utils.translation import ugettext_lazy as _ from jet.utils import LazyDateTimeEncoder +try: + from django.utils.encoding import python_2_unicode_compatible +except ImportError: + from six import python_2_unicode_compatible @python_2_unicode_compatible class UserDashboardModule(models.Model): diff --git a/jet/dashboard/templates/admin/index.html b/jet/dashboard/templates/admin/index.html index 228ece54..bb351728 100644 --- a/jet/dashboard/templates/admin/index.html +++ b/jet/dashboard/templates/admin/index.html @@ -1,5 +1,5 @@ {% extends "admin/base_site.html" %} -{% load i18n admin_static jet_dashboard_tags static %} +{% load i18n static jet_dashboard_tags static %} {% block html %}{% get_dashboard 'index' as dashboard %}{{ block.super }}{% endblock %} diff --git a/jet/models.py b/jet/models.py index 8fe97564..e0973739 100644 --- a/jet/models.py +++ b/jet/models.py @@ -1,8 +1,11 @@ from django.db import models from django.utils import timezone -from django.utils.encoding import python_2_unicode_compatible from django.utils.translation import ugettext_lazy as _ +try: + from django.utils.encoding import python_2_unicode_compatible +except ImportError: + from six import python_2_unicode_compatible @python_2_unicode_compatible class Bookmark(models.Model): diff --git a/jet/templates/admin/edit_inline/compact.html b/jet/templates/admin/edit_inline/compact.html index dd4232ee..52d5a5ac 100644 --- a/jet/templates/admin/edit_inline/compact.html +++ b/jet/templates/admin/edit_inline/compact.html @@ -1,4 +1,4 @@ -{% load i18n admin_urls admin_static %} +{% load i18n admin_urls static %}

{{ inline_admin_formset.opts.verbose_name_plural|capfirst }}

diff --git a/jet/templates/rangefilter/date_filter.html b/jet/templates/rangefilter/date_filter.html index f0e47656..47327ec0 100644 --- a/jet/templates/rangefilter/date_filter.html +++ b/jet/templates/rangefilter/date_filter.html @@ -1,4 +1,4 @@ -{% load i18n admin_static %} +{% load i18n static %}

{% blocktrans with filter_title=title %} By {{ filter_title }} {% endblocktrans %}