Show More
@@ -3,6 +3,7 b' from django.shortcuts import render' | |||||
3 | from boards.authors import authors |
|
3 | from boards.authors import authors | |
4 | from boards.views.base import BaseBoardView |
|
4 | from boards.views.base import BaseBoardView | |
5 |
|
5 | |||
|
6 | ||||
6 | class AuthorsView(BaseBoardView): |
|
7 | class AuthorsView(BaseBoardView): | |
7 |
|
8 | |||
8 | def get(self, request): |
|
9 | def get(self, request): |
@@ -1,8 +1,10 b'' | |||||
1 | from django.db import transaction |
|
1 | from django.db import transaction | |
|
2 | from django.shortcuts import get_object_or_404 | |||
2 |
|
3 | |||
3 | from boards.views.base import BaseBoardView |
|
4 | from boards.views.base import BaseBoardView | |
4 | from boards.models import Post, Ban |
|
5 | from boards.models import Post, Ban | |
5 |
|
6 | |||
|
7 | ||||
6 | class BanUserView(BaseBoardView): |
|
8 | class BanUserView(BaseBoardView): | |
7 |
|
9 | |||
8 | @transaction.atomic |
|
10 | @transaction.atomic |
@@ -5,6 +5,7 b' from boards.views.base import BaseBoardV' | |||||
5 | from boards.views.redirect_next_mixin import RedirectNextMixin |
|
5 | from boards.views.redirect_next_mixin import RedirectNextMixin | |
6 | from boards.models import Post |
|
6 | from boards.models import Post | |
7 |
|
7 | |||
|
8 | ||||
8 | class DeletePostView(BaseBoardView, RedirectNextMixin): |
|
9 | class DeletePostView(BaseBoardView, RedirectNextMixin): | |
9 |
|
10 | |||
10 | @transaction.atomic |
|
11 | @transaction.atomic |
@@ -2,10 +2,11 b' from django.shortcuts import render' | |||||
2 |
|
2 | |||
3 | from boards.views.base import BaseBoardView |
|
3 | from boards.views.base import BaseBoardView | |
4 |
|
4 | |||
|
5 | ||||
5 | class NotFoundView(BaseBoardView): |
|
6 | class NotFoundView(BaseBoardView): | |
6 | ''' |
|
7 | """ | |
7 | Page 404 (not found) |
|
8 | Page 404 (not found) | |
8 | ''' |
|
9 | """ | |
9 |
|
10 | |||
10 | def get(self, request): |
|
11 | def get(self, request): | |
11 | context = self.get_context_data(request=request) |
|
12 | context = self.get_context_data(request=request) |
@@ -1,6 +1,7 b'' | |||||
1 | from django.shortcuts import redirect |
|
1 | from django.shortcuts import redirect | |
2 | from django.http import HttpResponseRedirect |
|
2 | from django.http import HttpResponseRedirect | |
3 |
|
3 | |||
|
4 | ||||
4 | class RedirectNextMixin: |
|
5 | class RedirectNextMixin: | |
5 |
|
6 | |||
6 | def redirect_to_next(self, request): |
|
7 | def redirect_to_next(self, request): |
@@ -5,6 +5,7 b' from boards.views.base import BaseBoardV' | |||||
5 | from boards.forms import SettingsForm, ModeratorSettingsForm, PlainErrorList |
|
5 | from boards.forms import SettingsForm, ModeratorSettingsForm, PlainErrorList | |
6 | from boards.views import SETTING_MODERATE |
|
6 | from boards.views import SETTING_MODERATE | |
7 |
|
7 | |||
|
8 | ||||
8 | class SettingsView(BaseBoardView): |
|
9 | class SettingsView(BaseBoardView): | |
9 |
|
10 | |||
10 | def get(self, request): |
|
11 | def get(self, request): | |
@@ -15,9 +16,10 b' class SettingsView(BaseBoardView):' | |||||
15 | selected_theme = context['theme'] |
|
16 | selected_theme = context['theme'] | |
16 |
|
17 | |||
17 | if is_moderator: |
|
18 | if is_moderator: | |
18 |
form = ModeratorSettingsForm(initial={ |
|
19 | form = ModeratorSettingsForm(initial={ | |
19 | 'moderate': context['moderator']}, |
|
20 | 'theme': selected_theme, | |
20 | error_class=PlainErrorList) |
|
21 | 'moderate': context['moderator'] | |
|
22 | }, error_class=PlainErrorList) | |||
21 | else: |
|
23 | else: | |
22 | form = SettingsForm(initial={'theme': selected_theme}, |
|
24 | form = SettingsForm(initial={'theme': selected_theme}, | |
23 | error_class=PlainErrorList) |
|
25 | error_class=PlainErrorList) |
@@ -116,6 +116,6 b' class ThreadView(BaseBoardView, PostMixi' | |||||
116 |
|
116 | |||
117 | if html_response: |
|
117 | if html_response: | |
118 | if opening_post: |
|
118 | if opening_post: | |
119 |
return redirect(reverse( |
|
119 | return redirect(reverse( | |
120 | kwargs={'post_id': thread_to_show}) + '#' |
|
120 | 'thread', | |
121 |
|
|
121 | kwargs={'post_id': thread_to_show}) + '#' + str(post.id)) |
General Comments 0
You need to be logged in to leave comments.
Login now