##// 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 from django.conf.urls import patterns, url
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 from boards import views
4 from boards import views
5 from boards.rss import AllThreadsFeed, TagThreadsFeed, ThreadPostsFeed
5 from boards.rss import AllThreadsFeed, TagThreadsFeed, ThreadPostsFeed
6 from boards.views import api, tag_threads, all_threads, \
6 from boards.views import api, tag_threads, all_threads, \
7 settings, all_tags, feed
7 settings, all_tags, feed
8 from boards.views.authors import AuthorsView
8 from boards.views.authors import AuthorsView
9 from boards.views.notifications import NotificationView
9 from boards.views.notifications import NotificationView
10 from boards.views.search import BoardSearchView
10 from boards.views.search import BoardSearchView
11 from boards.views.static import StaticPageView
11 from boards.views.static import StaticPageView
12 from boards.views.preview import PostPreviewView
12 from boards.views.preview import PostPreviewView
13 from boards.views.random import RandomImageView
13 from boards.views.random import RandomImageView
14 from boards.views.translation import cached_javascript_catalog
14
15
15
16
16 js_info_dict = {
17 js_info_dict = {
17 'packages': ('boards',),
18 'packages': ('boards',),
18 }
19 }
19
20
20 urlpatterns = patterns('',
21 urlpatterns = patterns('',
21 # /boards/
22 # /boards/
22 url(r'^$', all_threads.AllThreadsView.as_view(), name='index'),
23 url(r'^$', all_threads.AllThreadsView.as_view(), name='index'),
23
24
24 # /boards/tag/tag_name/
25 # /boards/tag/tag_name/
25 url(r'^tag/(?P<tag_name>\w+)/$', tag_threads.TagView.as_view(),
26 url(r'^tag/(?P<tag_name>\w+)/$', tag_threads.TagView.as_view(),
26 name='tag'),
27 name='tag'),
27
28
28 # /boards/thread/
29 # /boards/thread/
29 url(r'^thread/(?P<post_id>\d+)/$', views.thread.NormalThreadView.as_view(),
30 url(r'^thread/(?P<post_id>\d+)/$', views.thread.NormalThreadView.as_view(),
30 name='thread'),
31 name='thread'),
31 url(r'^thread/(?P<post_id>\d+)/mode/gallery/$', views.thread.GalleryThreadView.as_view(),
32 url(r'^thread/(?P<post_id>\d+)/mode/gallery/$', views.thread.GalleryThreadView.as_view(),
32 name='thread_gallery'),
33 name='thread_gallery'),
33 url(r'^thread/(?P<post_id>\d+)/mode/tree/$', views.thread.TreeThreadView.as_view(),
34 url(r'^thread/(?P<post_id>\d+)/mode/tree/$', views.thread.TreeThreadView.as_view(),
34 name='thread_tree'),
35 name='thread_tree'),
35 # /feed/
36 # /feed/
36 url(r'^feed/$', views.feed.FeedView.as_view(), name='feed'),
37 url(r'^feed/$', views.feed.FeedView.as_view(), name='feed'),
37
38
38 url(r'^settings/$', settings.SettingsView.as_view(), name='settings'),
39 url(r'^settings/$', settings.SettingsView.as_view(), name='settings'),
39 url(r'^tags/(?P<query>\w+)?/?$', all_tags.AllTagsView.as_view(), name='tags'),
40 url(r'^tags/(?P<query>\w+)?/?$', all_tags.AllTagsView.as_view(), name='tags'),
40 url(r'^authors/$', AuthorsView.as_view(), name='authors'),
41 url(r'^authors/$', AuthorsView.as_view(), name='authors'),
41
42
42 url(r'^banned/$', views.banned.BannedView.as_view(), name='banned'),
43 url(r'^banned/$', views.banned.BannedView.as_view(), name='banned'),
43 url(r'^staticpage/(?P<name>\w+)/$', StaticPageView.as_view(),
44 url(r'^staticpage/(?P<name>\w+)/$', StaticPageView.as_view(),
44 name='staticpage'),
45 name='staticpage'),
45
46
46 url(r'^random/$', RandomImageView.as_view(), name='random'),
47 url(r'^random/$', RandomImageView.as_view(), name='random'),
47
48
48 # RSS feeds
49 # RSS feeds
49 url(r'^rss/$', AllThreadsFeed()),
50 url(r'^rss/$', AllThreadsFeed()),
50 url(r'^page/(?P<page>\d+)/rss/$', AllThreadsFeed()),
51 url(r'^page/(?P<page>\d+)/rss/$', AllThreadsFeed()),
51 url(r'^tag/(?P<tag_name>\w+)/rss/$', TagThreadsFeed()),
52 url(r'^tag/(?P<tag_name>\w+)/rss/$', TagThreadsFeed()),
52 url(r'^tag/(?P<tag_name>\w+)/page/(?P<page>\w+)/rss/$', TagThreadsFeed()),
53 url(r'^tag/(?P<tag_name>\w+)/page/(?P<page>\w+)/rss/$', TagThreadsFeed()),
53 url(r'^thread/(?P<post_id>\d+)/rss/$', ThreadPostsFeed()),
54 url(r'^thread/(?P<post_id>\d+)/rss/$', ThreadPostsFeed()),
54
55
55 # i18n
56 # i18n
56 url(r'^jsi18n/$', javascript_catalog, js_info_dict,
57 url(r'^jsi18n/$', cached_javascript_catalog, js_info_dict,
57 name='js_info_dict'),
58 name='js_info_dict'),
58
59
59 # API
60 # API
60 url(r'^api/post/(?P<post_id>\d+)/$', api.get_post, name="get_post"),
61 url(r'^api/post/(?P<post_id>\d+)/$', api.get_post, name="get_post"),
61 url(r'^api/diff_thread/$', api.api_get_threaddiff, name="get_thread_diff"),
62 url(r'^api/diff_thread/$', api.api_get_threaddiff, name="get_thread_diff"),
62 url(r'^api/threads/(?P<count>\w+)/$', api.api_get_threads,
63 url(r'^api/threads/(?P<count>\w+)/$', api.api_get_threads,
63 name='get_threads'),
64 name='get_threads'),
64 url(r'^api/tags/$', api.api_get_tags, name='get_tags'),
65 url(r'^api/tags/$', api.api_get_tags, name='get_tags'),
65 url(r'^api/thread/(?P<opening_post_id>\w+)/$', api.api_get_thread_posts,
66 url(r'^api/thread/(?P<opening_post_id>\w+)/$', api.api_get_thread_posts,
66 name='get_thread'),
67 name='get_thread'),
67 url(r'^api/add_post/(?P<opening_post_id>\w+)/$', api.api_add_post,
68 url(r'^api/add_post/(?P<opening_post_id>\w+)/$', api.api_add_post,
68 name='add_post'),
69 name='add_post'),
69 url(r'^api/notifications/(?P<username>\w+)/$', api.api_get_notifications,
70 url(r'^api/notifications/(?P<username>\w+)/$', api.api_get_notifications,
70 name='api_notifications'),
71 name='api_notifications'),
71 url(r'^api/preview/$', api.api_get_preview, name='preview'),
72 url(r'^api/preview/$', api.api_get_preview, name='preview'),
72 url(r'^api/new_posts/$', api.api_get_new_posts, name='new_posts'),
73 url(r'^api/new_posts/$', api.api_get_new_posts, name='new_posts'),
73
74
74 # Search
75 # Search
75 url(r'^search/$', BoardSearchView.as_view(), name='search'),
76 url(r'^search/$', BoardSearchView.as_view(), name='search'),
76
77
77 # Notifications
78 # Notifications
78 url(r'^notifications/(?P<username>\w+)$', NotificationView.as_view(), name='notifications'),
79 url(r'^notifications/(?P<username>\w+)$', NotificationView.as_view(), name='notifications'),
79
80
80 # Post preview
81 # Post preview
81 url(r'^preview/$', PostPreviewView.as_view(), name='preview')
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