##// END OF EJS Templates
Delete thread when banning OP
neko259 -
r1901:fd30e4ee default
parent child Browse files
Show More
@@ -1,21 +1,24 b''
1 1 from django.shortcuts import redirect
2 2 from django.utils.decorators import method_decorator
3 3 from django.views.decorators.csrf import csrf_protect
4 4 from boards.views.base import BaseBoardView, CONTEXT_FORM
5 5 from boards.views.mixins import DispatcherMixin, PARAMETER_METHOD
6 6 from boards.models import Post, Ban
7 7
8 8
9 9 class UtilsView(BaseBoardView, DispatcherMixin):
10 10 @method_decorator(csrf_protect)
11 11 def get(self, request):
12 12 self.dispatch_method(request)
13 13
14 14 return redirect('index')
15 15
16 16
17 17 def ban_and_delete(self, request):
18 18 post = Post.objects.get(id=request.GET['post_id'])
19 19 Ban.objects.get_or_create(ip=post.poster_ip)
20 if post.is_opening():
21 post.get_thread().delete()
22 else:
20 23 post.delete()
21 24
General Comments 0
You need to be logged in to leave comments. Login now