Show More
@@ -0,0 +1,21 b'' | |||||
|
1 | from django.shortcuts import redirect | |||
|
2 | from django.utils.decorators import method_decorator | |||
|
3 | from django.views.decorators.csrf import csrf_protect | |||
|
4 | from boards.views.base import BaseBoardView, CONTEXT_FORM | |||
|
5 | from boards.views.mixins import DispatcherMixin, PARAMETER_METHOD | |||
|
6 | from boards.models import Post, Ban | |||
|
7 | ||||
|
8 | ||||
|
9 | class UtilsView(BaseBoardView, DispatcherMixin): | |||
|
10 | @method_decorator(csrf_protect) | |||
|
11 | def get(self, request): | |||
|
12 | self.dispatch_method(request) | |||
|
13 | ||||
|
14 | return redirect('index') | |||
|
15 | ||||
|
16 | ||||
|
17 | def ban_and_delete(self, request): | |||
|
18 | post = Post.objects.get(id=request.GET['post_id']) | |||
|
19 | Ban.objects.get_or_create(ip=post.poster_ip) | |||
|
20 | post.delete() | |||
|
21 |
@@ -98,6 +98,13 b'' | |||||
98 | window.location = '{% url 'post_sync_data' post.id %}'; |
|
98 | window.location = '{% url 'post_sync_data' post.id %}'; | |
99 | }, |
|
99 | }, | |
100 | visible: {% if post.global_id_id %}true{% else %}false{% endif %} |
|
100 | visible: {% if post.global_id_id %}true{% else %}false{% endif %} | |
|
101 | }, | |||
|
102 | banAndDelete: { | |||
|
103 | name: 'Ban and delete', | |||
|
104 | callback: function(key, opt) { | |||
|
105 | window.location = '{% url 'utils' %}?method=ban_and_delete&post_id={{ post.id }}'; | |||
|
106 | }, | |||
|
107 | visible: {% if post.has_ip %}true{% else %}false{% endif %} | |||
101 | } |
|
108 | } | |
102 | } |
|
109 | } | |
103 | }; |
|
110 | }; |
@@ -16,6 +16,7 b' from boards.views.tag_gallery import Tag' | |||||
16 | from boards.views.translation import cached_javascript_catalog |
|
16 | from boards.views.translation import cached_javascript_catalog | |
17 | from boards.views.search import BoardSearchView |
|
17 | from boards.views.search import BoardSearchView | |
18 | from boards.views.landing import LandingView |
|
18 | from boards.views.landing import LandingView | |
|
19 | from boards.views.utils import UtilsView | |||
19 |
|
20 | |||
20 |
|
21 | |||
21 | js_info_dict = { |
|
22 | js_info_dict = { | |
@@ -53,6 +54,7 b' urlpatterns = [' | |||||
53 | url(r'^tag/(?P<tag_name>\w+)/gallery/$', TagGalleryView.as_view(), name='tag_gallery'), |
|
54 | url(r'^tag/(?P<tag_name>\w+)/gallery/$', TagGalleryView.as_view(), name='tag_gallery'), | |
54 | url(r'^search/$', BoardSearchView.as_view(), name='search'), |
|
55 | url(r'^search/$', BoardSearchView.as_view(), name='search'), | |
55 | url(r'^$', LandingView.as_view(), name='landing'), |
|
56 | url(r'^$', LandingView.as_view(), name='landing'), | |
|
57 | url(r'^utils$', UtilsView.as_view(), name='utils'), | |||
56 |
|
58 | |||
57 | # RSS feeds |
|
59 | # RSS feeds | |
58 | url(r'^rss/$', AllThreadsFeed()), |
|
60 | url(r'^rss/$', AllThreadsFeed()), |
General Comments 0
You need to be logged in to leave comments.
Login now