Show More
@@ -4,6 +4,7 b' from boards.models import Banner' | |||
|
4 | 4 | from boards.models.user import Notification |
|
5 | 5 | from boards import settings |
|
6 | 6 | from boards.models import Post, Tag, Thread |
|
7 | from boards.settings import SECTION_FORMS | |
|
7 | 8 | |
|
8 | 9 | CONTEXT_SITE_NAME = 'site_name' |
|
9 | 10 | CONTEXT_VERSION = 'version' |
@@ -66,7 +67,7 b' def user_and_ui_processor(request):' | |||
|
66 | 67 | |
|
67 | 68 | if (settings.get_bool('Forms', 'LimitFirstPosting') and not settings_manager.get_setting('confirmed_user'))\ |
|
68 | 69 | or settings.get_bool('Forms', 'LimitPostingSpeed'): |
|
69 |
context[CONTEXT_POW_DIFFICULTY] = settings.get_int( |
|
|
70 | context[CONTEXT_POW_DIFFICULTY] = settings.get_int(SECTION_FORMS, 'PowDifficulty') | |
|
70 | 71 | |
|
71 | 72 | context[CONTEXT_IMAGE_VIEWER] = settings_manager.get_setting( |
|
72 | 73 | SETTING_IMAGE_VIEWER, |
@@ -10,7 +10,8 b' from boards import settings' | |||
|
10 | 10 | from boards.models import STATUS_BUMPLIMIT, STATUS_ACTIVE, STATUS_ARCHIVE |
|
11 | 11 | from boards.models.attachment import FILE_TYPES_IMAGE |
|
12 | 12 | from boards.models.post import Post |
|
13 |
from boards.models.tag import Tag, |
|
|
13 | from boards.models.tag import Tag, TagAlias | |
|
14 | from boards.settings import SECTION_VIEW | |
|
14 | 15 | from boards.utils import cached_result, datetime_to_epoch |
|
15 | 16 | |
|
16 | 17 | FAV_THREAD_NO_UPDATES = -1 |
@@ -157,7 +158,7 b' class Thread(models.Model):' | |||
|
157 | 158 | Gets several last replies, not including opening post |
|
158 | 159 | """ |
|
159 | 160 | |
|
160 |
last_replies_count = settings.get_int( |
|
|
161 | last_replies_count = settings.get_int(SECTION_VIEW, 'LastRepliesCount') | |
|
161 | 162 | |
|
162 | 163 | if last_replies_count > 0: |
|
163 | 164 | reply_count = self.get_reply_count() |
@@ -175,7 +176,7 b' class Thread(models.Model):' | |||
|
175 | 176 | Gets number of posts between opening post and last replies. |
|
176 | 177 | """ |
|
177 | 178 | reply_count = self.get_reply_count() |
|
178 |
last_replies_count = min(settings.get_int( |
|
|
179 | last_replies_count = min(settings.get_int(SECTION_VIEW, 'LastRepliesCount'), | |
|
179 | 180 | reply_count - 1) |
|
180 | 181 | return reply_count - last_replies_count - 1 |
|
181 | 182 |
@@ -4,6 +4,7 b' from django.test import TestCase' | |||
|
4 | 4 | from boards import settings |
|
5 | 5 | from boards.models import Tag, Post, Thread, KeyPair |
|
6 | 6 | from boards.models.thread import STATUS_ARCHIVE |
|
7 | from boards.settings import SECTION_VIEW | |
|
7 | 8 | |
|
8 | 9 | |
|
9 | 10 | class PostTests(TestCase): |
@@ -93,17 +94,18 b' class PostTests(TestCase):' | |||
|
93 | 94 | def test_pages(self): |
|
94 | 95 | """Test that the thread list is properly split into pages""" |
|
95 | 96 | |
|
96 |
|
|
|
97 | threads_per_page = settings.get_int(SECTION_VIEW, 'ThreadsPerPage') | |
|
98 | for i in range(threads_per_page * 2): | |
|
97 | 99 | self._create_post() |
|
98 | 100 | |
|
99 | 101 | all_threads = Thread.objects.exclude(status=STATUS_ARCHIVE) |
|
100 | 102 | |
|
101 | 103 | paginator = Paginator(Thread.objects.exclude(status=STATUS_ARCHIVE), |
|
102 |
|
|
|
104 | threads_per_page) | |
|
103 | 105 | posts_in_second_page = paginator.page(2).object_list |
|
104 | 106 | first_post = posts_in_second_page[0] |
|
105 | 107 | |
|
106 |
self.assertEqual(all_threads[ |
|
|
108 | self.assertEqual(all_threads[threads_per_page].id, | |
|
107 | 109 | first_post.id) |
|
108 | 110 | |
|
109 | 111 | def test_reflinks(self): |
@@ -5,10 +5,11 b' from boards import settings' | |||
|
5 | 5 | from boards.abstracts.paginator import get_paginator |
|
6 | 6 | from boards.abstracts.settingsmanager import get_settings_manager |
|
7 | 7 | from boards.models import Post |
|
8 | from boards.settings import SECTION_VIEW | |
|
8 | 9 | from boards.views.base import BaseBoardView |
|
9 | 10 | from boards.views.mixins import PaginatedMixin |
|
10 | 11 | |
|
11 |
POSTS_PER_PAGE = settings.get_int( |
|
|
12 | POSTS_PER_PAGE = settings.get_int(SECTION_VIEW, 'PostsPerPage') | |
|
12 | 13 | |
|
13 | 14 | PARAMETER_POSTS = 'posts' |
|
14 | 15 | PARAMETER_QUERIES = 'queries' |
@@ -7,8 +7,8 b' from django.utils.decorators import meth' | |||
|
7 | 7 | from django.views.decorators.csrf import csrf_protect |
|
8 | 8 | |
|
9 | 9 | from boards import settings |
|
10 |
from boards.models import Post, Tag, |
|
|
11 |
from boards. |
|
|
10 | from boards.models import Post, Tag, STATUS_ACTIVE, TagAlias | |
|
11 | from boards.settings import SECTION_VIEW | |
|
12 | 12 | from boards.views.base import BaseBoardView |
|
13 | 13 | |
|
14 | 14 | PARAM_SECTION_STR = 'section_str' |
@@ -31,7 +31,7 b' class LandingView(BaseBoardView):' | |||
|
31 | 31 | .annotate(today_post_count=Count('thread__replies'))\ |
|
32 | 32 | .order_by('-pub_time') |
|
33 | 33 | |
|
34 |
max_landing_threads = settings.get_int( |
|
|
34 | max_landing_threads = settings.get_int(SECTION_VIEW, 'MaxLandingThreads') | |
|
35 | 35 | if max_landing_threads > 0: |
|
36 | 36 | ops = ops[:max_landing_threads] |
|
37 | 37 |
@@ -4,10 +4,11 b' from django.urls import reverse' | |||
|
4 | 4 | from boards import settings |
|
5 | 5 | from boards.abstracts.paginator import get_paginator |
|
6 | 6 | from boards.models import TagAlias |
|
7 | from boards.settings import SECTION_VIEW | |
|
7 | 8 | from boards.views.base import BaseBoardView |
|
8 | 9 | from boards.views.mixins import PaginatedMixin |
|
9 | 10 | |
|
10 |
IMAGES_PER_PAGE = settings.get_int( |
|
|
11 | IMAGES_PER_PAGE = settings.get_int(SECTION_VIEW, 'ImagesPerPageGallery') | |
|
11 | 12 | |
|
12 | 13 | TEMPLATE = 'boards/tag_gallery.html' |
|
13 | 14 |
@@ -1,4 +1,5 b'' | |||
|
1 | 1 | from boards import settings |
|
2 | from boards.settings import SECTION_FORMS | |
|
2 | 3 | from boards.views.thread import ThreadView |
|
3 | 4 | from boards.views.mixins import FileUploadMixin |
|
4 | 5 | |
@@ -31,6 +32,6 b' class NormalThreadView(ThreadView, FileU' | |||
|
31 | 32 | params[CONTEXT_BUMPLIMIT_PRG] = str( |
|
32 | 33 | float(left_posts) / max_posts * 100) |
|
33 | 34 | params[PARAM_MAX_FILE_SIZE] = self.get_max_upload_size() |
|
34 |
params[PARAM_MAX_FILES] = settings.get_int( |
|
|
35 | params[PARAM_MAX_FILES] = settings.get_int(SECTION_FORMS, 'MaxFileCount') | |
|
35 | 36 | |
|
36 | 37 | return params |
General Comments 0
You need to be logged in to leave comments.
Login now