##// END OF EJS Templates
Speed up page loading by caching JS translation catalog
neko259 -
r423:3d225171 default
parent child Browse files
Show More
@@ -25,7 +25,7 b''
25 <script src="{% static 'js/jquery-2.0.1.min.js' %}"></script>
25 <script src="{% static 'js/jquery-2.0.1.min.js' %}"></script>
26 <script src="{% static 'js/jquery-ui-1.10.3.custom.min.js' %}"></script>
26 <script src="{% static 'js/jquery-ui-1.10.3.custom.min.js' %}"></script>
27 <script src="{% static 'js/jquery.mousewheel.js' %}"></script>
27 <script src="{% static 'js/jquery.mousewheel.js' %}"></script>
28 <script src="{% url 'django.views.i18n.javascript_catalog' %}"></script>
28 <script src="{% url 'js_info_dict' %}"></script>
29 <script src="{% static 'js/panel.js' %}"></script>
29 <script src="{% static 'js/panel.js' %}"></script>
30 <script src="{% static 'js/popup.js' %}"></script>
30 <script src="{% static 'js/popup.js' %}"></script>
31 <script src="{% static 'js/image.js' %}"></script>
31 <script src="{% static 'js/image.js' %}"></script>
@@ -49,7 +49,7 b" urlpatterns = patterns('',"
49 url(r'^thread/(?P<post_id>\w+)/rss/$', ThreadPostsFeed()),
49 url(r'^thread/(?P<post_id>\w+)/rss/$', ThreadPostsFeed()),
50
50
51 # i18n
51 # i18n
52 url(r'^jsi18n/$', 'django.views.i18n.javascript_catalog', js_info_dict),
52 url(r'^jsi18n/$', 'boards.views.cached_js_catalog', js_info_dict, name='js_info_dict'),
53
53
54 # API
54 # API
55 url(r'^api/post/(?P<post_id>\w+)/$', views.get_post, name="get_post"),
55 url(r'^api/post/(?P<post_id>\w+)/$', views.get_post, name="get_post"),
@@ -13,6 +13,8 b' from django.template import RequestConte'
13 from django.shortcuts import render, redirect, get_object_or_404
13 from django.shortcuts import render, redirect, get_object_or_404
14 from django.utils import timezone
14 from django.utils import timezone
15 from django.db import transaction
15 from django.db import transaction
16 from django.views.decorators.cache import cache_page
17 from django.views.i18n import javascript_catalog
16
18
17 from boards import forms
19 from boards import forms
18 import boards
20 import boards
@@ -447,6 +449,10 b' def get_post(request, post_id):'
447
449
448 return render(request, 'boards/post.html', context)
450 return render(request, 'boards/post.html', context)
449
451
452 @cache_page(86400)
453 def cached_js_catalog(request, domain='djangojs', packages=None):
454 return javascript_catalog(request, domain, packages)
455
450
456
451 def _get_theme(request, user=None):
457 def _get_theme(request, user=None):
452 """Get user's CSS theme"""
458 """Get user's CSS theme"""
General Comments 0
You need to be logged in to leave comments. Login now