Bläddra i källkod

Fixes for Django 2.0+

Guillaume Lafranceschina 7 år sedan
förälder
incheckning
426972edcf
2 ändrade filer med 18 tillägg och 4 borttagningar
  1. 9 2
      jet/dashboard/urls.py
  2. 9 2
      jet/urls.py

+ 9 - 2
jet/dashboard/urls.py

@@ -1,6 +1,13 @@
 import django
 from django.conf.urls import url
-from django.views.i18n import javascript_catalog
+
+try:
+    from django.views.i18n import javascript_catalog
+    jsc_view = javascript_catalog
+except ImportError:
+    from django.views.i18n import JavaScriptCatalog
+    jsc_view = JavaScriptCatalog.as_view()
+
 from jet.dashboard import dashboard
 from jet.dashboard.views import update_dashboard_modules_view, add_user_dashboard_module_view, \
     update_dashboard_module_collapse_view, remove_dashboard_module_view, UpdateDashboardModuleView, \
@@ -44,7 +51,7 @@ urlpatterns = [
     ),
     url(
         r'^jsi18n/$',
-        javascript_catalog,
+        jsc_view,
         {'packages': ('jet',)},
         name='jsi18n'
     ),

+ 9 - 2
jet/urls.py

@@ -1,6 +1,13 @@
 import django
 from django.conf.urls import url
-from django.views.i18n import javascript_catalog
+
+try:
+    from django.views.i18n import javascript_catalog
+    jsc_view = javascript_catalog
+except ImportError:
+    from django.views.i18n import JavaScriptCatalog
+    jsc_view = JavaScriptCatalog.as_view()
+
 from jet.views import add_bookmark_view, remove_bookmark_view, toggle_application_pin_view, model_lookup_view
 
 urlpatterns = [
@@ -26,7 +33,7 @@ urlpatterns = [
     ),
     url(
         r'^jsi18n/$',
-        javascript_catalog,
+        jsc_view,
         {'packages': ('django.conf', 'django.contrib.admin', 'jet',)},
         name='jsi18n'
     ),