##// END OF EJS Templates
Removed unused mixin. Refactored paginator a bit
neko259 -
r2035:3dd433d2 default
parent child Browse files
Show More
@@ -1,3 +1,5 b''
1 from boards.abstracts.constants import PARAM_PAGE
2
1 3 __author__ = 'neko259'
2 4
3 5 from django.core.paginator import Paginator
@@ -72,10 +74,10 b' class DividedPaginator(Paginator):'
72 74 self.params = params
73 75
74 76 def get_page_url(self, page):
75 self.params['page'] = page
76 url_params = '?' + '&'.join(['{}={}'.format(key, self.params[key])
77 self.params[PARAM_PAGE] = page
78 url_params = '&'.join(['{}={}'.format(key, self.params[key])
77 79 for key in self.params.keys()])
78 return self.link + url_params
80 return '{}?{}'.format(self.link, url_params)
79 81
80 82 def supports_urls(self):
81 83 return self.link is not None and self.params is not None
@@ -88,4 +90,4 b' class DividedPaginator(Paginator):'
88 90 def get_prev_page_url(self):
89 91 current = self.page(self.current_page)
90 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 1 from django.core.paginator import EmptyPage
2 2 from django.http import Http404
3 from django.shortcuts import render, redirect
3 from django.shortcuts import render
4 4 from django.urls import reverse
5 5 from django.utils.decorators import method_decorator
6 6 from django.views.decorators.csrf import csrf_protect
@@ -12,10 +12,10 b' from boards.abstracts.settingsmanager im'
12 12 SETTING_ONLY_FAVORITES
13 13 from boards.forms import ThreadForm, PlainErrorList
14 14 from boards.models import Post, Thread
15 from boards.settings import SECTION_VIEW
15 16 from boards.views.base import BaseBoardView, CONTEXT_FORM
16 from boards.views.mixins import FileUploadMixin, PaginatedMixin, \
17 from boards.views.mixins import PaginatedMixin, \
17 18 DispatcherMixin, PARAMETER_METHOD
18 from boards.settings import SECTION_VIEW, SECTION_FORMS
19 19
20 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 2 PARAMETER_METHOD = 'method'
6 3
@@ -35,12 +32,6 b' class DispatcherMixin:'
35 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 35 class PaginatedMixin:
45 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 3 TEMPLATE_NORMAL = 'boards/thread_normal.html'
7 4
General Comments 0
You need to be logged in to leave comments. Login now