diff --git a/boards/abstracts/paginator.py b/boards/abstracts/paginator.py --- a/boards/abstracts/paginator.py +++ b/boards/abstracts/paginator.py @@ -1,3 +1,5 @@ +from boards.abstracts.constants import PARAM_PAGE + __author__ = 'neko259' from django.core.paginator import Paginator @@ -72,10 +74,10 @@ class DividedPaginator(Paginator): self.params = params def get_page_url(self, page): - self.params['page'] = page - url_params = '?' + '&'.join(['{}={}'.format(key, self.params[key]) - for key in self.params.keys()]) - return self.link + url_params + self.params[PARAM_PAGE] = page + url_params = '&'.join(['{}={}'.format(key, self.params[key]) + for key in self.params.keys()]) + return '{}?{}'.format(self.link, url_params) def supports_urls(self): return self.link is not None and self.params is not None @@ -88,4 +90,4 @@ class DividedPaginator(Paginator): def get_prev_page_url(self): current = self.page(self.current_page) if current.has_previous(): - return self.get_page_url(current.previous_page_number()) \ No newline at end of file + return self.get_page_url(current.previous_page_number()) diff --git a/boards/views/all_threads.py b/boards/views/all_threads.py --- a/boards/views/all_threads.py +++ b/boards/views/all_threads.py @@ -1,6 +1,6 @@ from django.core.paginator import EmptyPage from django.http import Http404 -from django.shortcuts import render, redirect +from django.shortcuts import render from django.urls import reverse from django.utils.decorators import method_decorator from django.views.decorators.csrf import csrf_protect @@ -12,10 +12,10 @@ from boards.abstracts.settingsmanager im SETTING_ONLY_FAVORITES from boards.forms import ThreadForm, PlainErrorList from boards.models import Post, Thread +from boards.settings import SECTION_VIEW from boards.views.base import BaseBoardView, CONTEXT_FORM -from boards.views.mixins import FileUploadMixin, PaginatedMixin, \ +from boards.views.mixins import PaginatedMixin, \ DispatcherMixin, PARAMETER_METHOD -from boards.settings import SECTION_VIEW, SECTION_FORMS ORDER_BUMP = 'bump' diff --git a/boards/views/mixins.py b/boards/views/mixins.py --- a/boards/views/mixins.py +++ b/boards/views/mixins.py @@ -1,6 +1,3 @@ -import boards -from boards.settings import SECTION_FORMS - PARAM_NEXT = 'next' PARAMETER_METHOD = 'method' @@ -35,12 +32,6 @@ class DispatcherMixin: return getattr(self, method_name)(*args, **kwargs) -# TODO Check if it is still used anywhere and safely remove -class FileUploadMixin: - def get_max_upload_size(self): - return boards.settings.get_int(SECTION_FORMS, 'MaxFileSize') - - class PaginatedMixin: def get_page_context(self, paginator, page): """ diff --git a/boards/views/thread/normal.py b/boards/views/thread/normal.py --- a/boards/views/thread/normal.py +++ b/boards/views/thread/normal.py @@ -1,7 +1,4 @@ -from boards import settings -from boards.settings import SECTION_FORMS from boards.views.thread import ThreadView -from boards.views.mixins import FileUploadMixin TEMPLATE_NORMAL = 'boards/thread_normal.html'