##// END OF EJS Templates
Fixed tag threads view
neko259 -
r919:84a3726d default
parent child Browse files
Show More
@@ -33,7 +33,7 b' class AllThreadsView(PostMixin, BaseBoar'
33 super(AllThreadsView, self).__init__()
33 super(AllThreadsView, self).__init__()
34
34
35 def get(self, request, page=DEFAULT_PAGE, form=None):
35 def get(self, request, page=DEFAULT_PAGE, form=None):
36 params = dict()
36 params = self.get_context_data(request=request)
37
37
38 if not form:
38 if not form:
39 form = ThreadForm(error_class=PlainErrorList)
39 form = ThreadForm(error_class=PlainErrorList)
@@ -14,15 +14,7 b" CONTEXT_FORM = 'form'"
14 class BaseBoardView(View):
14 class BaseBoardView(View):
15
15
16 def get_context_data(self, **kwargs):
16 def get_context_data(self, **kwargs):
17 """
17 return dict()
18 This method is deprecated. You need to use dicts instead of context
19 instances in all places it is used now.
20 """
21
22 request = kwargs['request']
23 context = RequestContext(request)
24
25 return context
26
18
27 @transaction.atomic
19 @transaction.atomic
28 def _ban_current_user(self, request):
20 def _ban_current_user(self, request):
@@ -9,10 +9,9 b' class NotFoundView(BaseBoardView):'
9 """
9 """
10
10
11 def get(self, request):
11 def get(self, request):
12 context = self.get_context_data(request=request)
12 params = self.get_context_data()
13
13
14 # TODO Use dict here
14 response = render(request, 'boards/404.html', params)
15 response = render(request, 'boards/404.html', context_instance=context)
16 response.status_code = 404
15 response.status_code = 404
17
16
18 return response
17 return response
@@ -13,7 +13,7 b" CONTEXT_HIDDEN_TAGS = 'hidden_tags'"
13 class SettingsView(BaseBoardView):
13 class SettingsView(BaseBoardView):
14
14
15 def get(self, request):
15 def get(self, request):
16 context = self.get_context_data(request=request)
16 params = self.get_context_data()
17 settings_manager = get_settings_manager(request)
17 settings_manager = get_settings_manager(request)
18
18
19 selected_theme = settings_manager.get_theme()
19 selected_theme = settings_manager.get_theme()
@@ -21,11 +21,11 b' class SettingsView(BaseBoardView):'
21 form = SettingsForm(initial={FORM_THEME: selected_theme},
21 form = SettingsForm(initial={FORM_THEME: selected_theme},
22 error_class=PlainErrorList)
22 error_class=PlainErrorList)
23
23
24 context[CONTEXT_FORM] = form
24 params[CONTEXT_FORM] = form
25 context[CONTEXT_HIDDEN_TAGS] = settings_manager.get_hidden_tags()
25 params[CONTEXT_HIDDEN_TAGS] = settings_manager.get_hidden_tags()
26
26
27 # TODO Use dict here
27 # TODO Use dict here
28 return render(request, 'boards/settings.html', context_instance=context)
28 return render(request, 'boards/settings.html', params)
29
29
30 def post(self, request):
30 def post(self, request):
31 settings_manager = get_settings_manager(request)
31 settings_manager = get_settings_manager(request)
@@ -10,8 +10,4 b' class StaticPageView(BaseBoardView):'
10 Show a static page that needs only tags list and a CSS
10 Show a static page that needs only tags list and a CSS
11 """
11 """
12
12
13 context = self.get_context_data(request=request)
13 return render(request, 'boards/staticpages/' + name + '.html')
14
15 # TODO Use dict here
16 return render(request, 'boards/staticpages/' + name + '.html',
17 context_instance=context)
@@ -23,17 +23,17 b' class TagView(AllThreadsView, Dispatcher'
23 return tag.get_threads()
23 return tag.get_threads()
24
24
25 def get_context_data(self, **kwargs):
25 def get_context_data(self, **kwargs):
26 context = super(TagView, self).get_context_data(**kwargs)
26 params = super(TagView, self).get_context_data(**kwargs)
27
27
28 settings_manager = get_settings_manager(kwargs['request'])
28 settings_manager = get_settings_manager(kwargs['request'])
29
29
30 tag = get_object_or_404(Tag, name=self.tag_name)
30 tag = get_object_or_404(Tag, name=self.tag_name)
31 context[PARAM_TAG] = tag
31 params[PARAM_TAG] = tag
32
32
33 context[PARAM_FAV_TAGS] = settings_manager.get_fav_tags()
33 params[PARAM_FAV_TAGS] = settings_manager.get_fav_tags()
34 context[PARAM_HIDDEN_TAGS] = settings_manager.get_hidden_tags()
34 params[PARAM_HIDDEN_TAGS] = settings_manager.get_hidden_tags()
35
35
36 return context
36 return params
37
37
38 def get(self, request, tag_name, page=DEFAULT_PAGE, form=None):
38 def get(self, request, tag_name, page=DEFAULT_PAGE, form=None):
39 self.tag_name = tag_name
39 self.tag_name = tag_name
General Comments 0
You need to be logged in to leave comments. Login now