##// END OF EJS Templates
Fixed posting from the tag page
neko259 -
r597:05786152 default
parent child Browse files
Show More
@@ -2,6 +2,7 b' from django.shortcuts import get_object_'
2 from boards.models import Tag, Post
2 from boards.models import Tag, Post
3 from boards.views.all_threads import AllThreadsView, DEFAULT_PAGE
3 from boards.views.all_threads import AllThreadsView, DEFAULT_PAGE
4 from boards.views.mixins import DispatcherMixin, RedirectNextMixin
4 from boards.views.mixins import DispatcherMixin, RedirectNextMixin
5 from boards.forms import ThreadForm, PlainErrorList
5
6
6 __author__ = 'neko259'
7 __author__ = 'neko259'
7
8
@@ -23,14 +24,27 b' class TagView(AllThreadsView, Dispatcher'
23
24
24 return context
25 return context
25
26
26 def get(self, request, tag_name, page=DEFAULT_PAGE):
27 def get(self, request, tag_name, page=DEFAULT_PAGE, form=None):
27 self.tag_name = tag_name
28 self.tag_name = tag_name
28
29
29 dispatch_result = self.dispatch_method(request)
30 dispatch_result = self.dispatch_method(request)
30 if dispatch_result:
31 if dispatch_result:
31 return dispatch_result
32 return dispatch_result
32 else:
33 else:
33 return super(TagView, self).get(request, page)
34 return super(TagView, self).get(request, page, form)
35
36 def post(self, request, tag_name, page=DEFAULT_PAGE):
37 form = ThreadForm(request.POST, request.FILES,
38 error_class=PlainErrorList)
39 form.session = request.session
40
41 if form.is_valid():
42 return self._new_post(request, form)
43 if form.need_to_ban:
44 # Ban user because he is suspected to be a bot
45 self._ban_current_user(request)
46
47 return self.get(request, tag_name, page, form)
34
48
35 def subscribe(self, request):
49 def subscribe(self, request):
36 user = self._get_user(request)
50 user = self._get_user(request)
General Comments 0
You need to be logged in to leave comments. Login now