Skip to content

Commit 3af0a81

Browse files
committed
Alteração para ser compatível com Django 2.2
1 parent 1763fd6 commit 3af0a81

File tree

2 files changed

+3
-23
lines changed

2 files changed

+3
-23
lines changed

djangojs/context_serializer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ def handle_user(self, data):
9696
'is_superuser': False,
9797
'permissions': tuple(),
9898
}
99-
if 'django.contrib.sessions.middleware.SessionMiddleware' in settings.MIDDLEWARE_CLASSES:
99+
if 'django.contrib.sessions.middleware.SessionMiddleware' in settings.MIDDLEWARE:
100100
user = self.request.user
101-
data['user']['is_authenticated'] = user.is_authenticated()
101+
data['user']['is_authenticated'] = user.is_authenticated
102102
if hasattr(user, 'username'):
103103
data['user']['username'] = user.username
104104
elif hasattr(user, 'get_username'):

djangojs/urls.py

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,9 @@
1010
from djangojs.views import UrlsJsonView, ContextJsonView, JsInitView
1111

1212

13-
def js_info_dict():
14-
js_info_dict = {
15-
'packages': [],
16-
}
17-
18-
for app in settings.INSTALLED_APPS:
19-
if settings.JS_I18N_APPS and app not in settings.JS_I18N_APPS:
20-
continue
21-
if settings.JS_I18N_APPS_EXCLUDE and app in settings.JS_I18N_APPS_EXCLUDE:
22-
continue
23-
if app not in sys.modules:
24-
__import__(app)
25-
module = sys.modules[app]
26-
for path in module.__path__:
27-
if isdir(join(path, 'locale')):
28-
js_info_dict['packages'].append(app)
29-
break
30-
return js_info_dict
31-
32-
3313
urlpatterns = [
3414
re_path(r'^init\.js$', JsInitView.as_view(), name='django_js_init'),
3515
re_path(r'^urls$', UrlsJsonView.as_view(), name='django_js_urls'),
3616
re_path(r'^context$', ContextJsonView.as_view(), name='django_js_context'),
37-
re_path(r'^translation$', JavaScriptCatalog.as_view(), js_info_dict(), name='js_catalog'),
17+
re_path(r'^translation$', JavaScriptCatalog.as_view(), name='js_catalog'),
3818
]

0 commit comments

Comments
 (0)