##// END OF EJS Templates
Cache javascript translations
neko259 -
r1393:22dd8fd4 default
parent child Browse files
Show More
@@ -0,0 +1,7 b''
1 from django.views.decorators.cache import cache_page
2 from django.views.i18n import javascript_catalog
3
4 @cache_page(600)
5 def cached_javascript_catalog(request, domain='djangojs', packages=None):
6 return javascript_catalog(request, domain, packages)
7
@@ -1,83 +1,84 b''
1 1 from django.conf.urls import patterns, url
2 from django.views.i18n import javascript_catalog
2 #from django.views.i18n import javascript_catalog
3 3
4 4 from boards import views
5 5 from boards.rss import AllThreadsFeed, TagThreadsFeed, ThreadPostsFeed
6 6 from boards.views import api, tag_threads, all_threads, \
7 7 settings, all_tags, feed
8 8 from boards.views.authors import AuthorsView
9 9 from boards.views.notifications import NotificationView
10 10 from boards.views.search import BoardSearchView
11 11 from boards.views.static import StaticPageView
12 12 from boards.views.preview import PostPreviewView
13 13 from boards.views.random import RandomImageView
14 from boards.views.translation import cached_javascript_catalog
14 15
15 16
16 17 js_info_dict = {
17 18 'packages': ('boards',),
18 19 }
19 20
20 21 urlpatterns = patterns('',
21 22 # /boards/
22 23 url(r'^$', all_threads.AllThreadsView.as_view(), name='index'),
23 24
24 25 # /boards/tag/tag_name/
25 26 url(r'^tag/(?P<tag_name>\w+)/$', tag_threads.TagView.as_view(),
26 27 name='tag'),
27 28
28 29 # /boards/thread/
29 30 url(r'^thread/(?P<post_id>\d+)/$', views.thread.NormalThreadView.as_view(),
30 31 name='thread'),
31 32 url(r'^thread/(?P<post_id>\d+)/mode/gallery/$', views.thread.GalleryThreadView.as_view(),
32 33 name='thread_gallery'),
33 34 url(r'^thread/(?P<post_id>\d+)/mode/tree/$', views.thread.TreeThreadView.as_view(),
34 35 name='thread_tree'),
35 36 # /feed/
36 37 url(r'^feed/$', views.feed.FeedView.as_view(), name='feed'),
37 38
38 39 url(r'^settings/$', settings.SettingsView.as_view(), name='settings'),
39 40 url(r'^tags/(?P<query>\w+)?/?$', all_tags.AllTagsView.as_view(), name='tags'),
40 41 url(r'^authors/$', AuthorsView.as_view(), name='authors'),
41 42
42 43 url(r'^banned/$', views.banned.BannedView.as_view(), name='banned'),
43 44 url(r'^staticpage/(?P<name>\w+)/$', StaticPageView.as_view(),
44 45 name='staticpage'),
45 46
46 47 url(r'^random/$', RandomImageView.as_view(), name='random'),
47 48
48 49 # RSS feeds
49 50 url(r'^rss/$', AllThreadsFeed()),
50 51 url(r'^page/(?P<page>\d+)/rss/$', AllThreadsFeed()),
51 52 url(r'^tag/(?P<tag_name>\w+)/rss/$', TagThreadsFeed()),
52 53 url(r'^tag/(?P<tag_name>\w+)/page/(?P<page>\w+)/rss/$', TagThreadsFeed()),
53 54 url(r'^thread/(?P<post_id>\d+)/rss/$', ThreadPostsFeed()),
54 55
55 56 # i18n
56 url(r'^jsi18n/$', javascript_catalog, js_info_dict,
57 url(r'^jsi18n/$', cached_javascript_catalog, js_info_dict,
57 58 name='js_info_dict'),
58 59
59 60 # API
60 61 url(r'^api/post/(?P<post_id>\d+)/$', api.get_post, name="get_post"),
61 62 url(r'^api/diff_thread/$', api.api_get_threaddiff, name="get_thread_diff"),
62 63 url(r'^api/threads/(?P<count>\w+)/$', api.api_get_threads,
63 64 name='get_threads'),
64 65 url(r'^api/tags/$', api.api_get_tags, name='get_tags'),
65 66 url(r'^api/thread/(?P<opening_post_id>\w+)/$', api.api_get_thread_posts,
66 67 name='get_thread'),
67 68 url(r'^api/add_post/(?P<opening_post_id>\w+)/$', api.api_add_post,
68 69 name='add_post'),
69 70 url(r'^api/notifications/(?P<username>\w+)/$', api.api_get_notifications,
70 71 name='api_notifications'),
71 72 url(r'^api/preview/$', api.api_get_preview, name='preview'),
72 73 url(r'^api/new_posts/$', api.api_get_new_posts, name='new_posts'),
73 74
74 75 # Search
75 76 url(r'^search/$', BoardSearchView.as_view(), name='search'),
76 77
77 78 # Notifications
78 79 url(r'^notifications/(?P<username>\w+)$', NotificationView.as_view(), name='notifications'),
79 80
80 81 # Post preview
81 82 url(r'^preview/$', PostPreviewView.as_view(), name='preview')
82 83
83 84 )
General Comments 0
You need to be logged in to leave comments. Login now