Show More
@@ -1,3 +1,5 b'' | |||||
|
1 | from boards.abstracts.constants import PARAM_PAGE | |||
|
2 | ||||
1 | __author__ = 'neko259' |
|
3 | __author__ = 'neko259' | |
2 |
|
4 | |||
3 | from django.core.paginator import Paginator |
|
5 | from django.core.paginator import Paginator | |
@@ -72,10 +74,10 b' class DividedPaginator(Paginator):' | |||||
72 | self.params = params |
|
74 | self.params = params | |
73 |
|
75 | |||
74 | def get_page_url(self, page): |
|
76 | def get_page_url(self, page): | |
75 |
self.params[ |
|
77 | self.params[PARAM_PAGE] = page | |
76 |
url_params = |
|
78 | url_params = '&'.join(['{}={}'.format(key, self.params[key]) | |
77 |
|
|
79 | for key in self.params.keys()]) | |
78 |
return self.link |
|
80 | return '{}?{}'.format(self.link, url_params) | |
79 |
|
81 | |||
80 | def supports_urls(self): |
|
82 | def supports_urls(self): | |
81 | return self.link is not None and self.params is not None |
|
83 | return self.link is not None and self.params is not None | |
@@ -88,4 +90,4 b' class DividedPaginator(Paginator):' | |||||
88 | def get_prev_page_url(self): |
|
90 | def get_prev_page_url(self): | |
89 | current = self.page(self.current_page) |
|
91 | current = self.page(self.current_page) | |
90 | if current.has_previous(): |
|
92 | if current.has_previous(): | |
91 | return self.get_page_url(current.previous_page_number()) No newline at end of file |
|
93 | return self.get_page_url(current.previous_page_number()) |
@@ -1,6 +1,6 b'' | |||||
1 | from django.core.paginator import EmptyPage |
|
1 | from django.core.paginator import EmptyPage | |
2 | from django.http import Http404 |
|
2 | from django.http import Http404 | |
3 |
from django.shortcuts import render |
|
3 | from django.shortcuts import render | |
4 | from django.urls import reverse |
|
4 | from django.urls import reverse | |
5 | from django.utils.decorators import method_decorator |
|
5 | from django.utils.decorators import method_decorator | |
6 | from django.views.decorators.csrf import csrf_protect |
|
6 | from django.views.decorators.csrf import csrf_protect | |
@@ -12,10 +12,10 b' from boards.abstracts.settingsmanager im' | |||||
12 | SETTING_ONLY_FAVORITES |
|
12 | SETTING_ONLY_FAVORITES | |
13 | from boards.forms import ThreadForm, PlainErrorList |
|
13 | from boards.forms import ThreadForm, PlainErrorList | |
14 | from boards.models import Post, Thread |
|
14 | from boards.models import Post, Thread | |
|
15 | from boards.settings import SECTION_VIEW | |||
15 | from boards.views.base import BaseBoardView, CONTEXT_FORM |
|
16 | from boards.views.base import BaseBoardView, CONTEXT_FORM | |
16 |
from boards.views.mixins import |
|
17 | from boards.views.mixins import PaginatedMixin, \ | |
17 | DispatcherMixin, PARAMETER_METHOD |
|
18 | DispatcherMixin, PARAMETER_METHOD | |
18 | from boards.settings import SECTION_VIEW, SECTION_FORMS |
|
|||
19 |
|
19 | |||
20 | ORDER_BUMP = 'bump' |
|
20 | ORDER_BUMP = 'bump' | |
21 |
|
21 |
@@ -1,6 +1,3 b'' | |||||
1 | import boards |
|
|||
2 | from boards.settings import SECTION_FORMS |
|
|||
3 |
|
||||
4 |
|
|
1 | PARAM_NEXT = 'next' | |
5 | PARAMETER_METHOD = 'method' |
|
2 | PARAMETER_METHOD = 'method' | |
6 |
|
3 | |||
@@ -35,12 +32,6 b' class DispatcherMixin:' | |||||
35 | return getattr(self, method_name)(*args, **kwargs) |
|
32 | return getattr(self, method_name)(*args, **kwargs) | |
36 |
|
33 | |||
37 |
|
34 | |||
38 | # TODO Check if it is still used anywhere and safely remove |
|
|||
39 | class FileUploadMixin: |
|
|||
40 | def get_max_upload_size(self): |
|
|||
41 | return boards.settings.get_int(SECTION_FORMS, 'MaxFileSize') |
|
|||
42 |
|
||||
43 |
|
||||
44 | class PaginatedMixin: |
|
35 | class PaginatedMixin: | |
45 | def get_page_context(self, paginator, page): |
|
36 | def get_page_context(self, paginator, page): | |
46 | """ |
|
37 | """ |
@@ -1,7 +1,4 b'' | |||||
1 | from boards import settings |
|
|||
2 | from boards.settings import SECTION_FORMS |
|
|||
3 |
|
|
1 | from boards.views.thread import ThreadView | |
4 | from boards.views.mixins import FileUploadMixin |
|
|||
5 |
|
2 | |||
6 | TEMPLATE_NORMAL = 'boards/thread_normal.html' |
|
3 | TEMPLATE_NORMAL = 'boards/thread_normal.html' | |
7 |
|
4 |
General Comments 0
You need to be logged in to leave comments.
Login now