diff --git a/boards/locale/ru/LC_MESSAGES/django.mo b/boards/locale/ru/LC_MESSAGES/django.mo index f512f1dba9e9d8f0cfc8b35c50c24c967d65a3d3..c7d2699824dd79f7214793dbcf1ba68e67c6960c GIT binary patch literal 9275 zc$~#pYiu0V6~0hfz{E~Uv6B$v+`J$GcCizln;7CGPB8cpY=>8&Vd9D(FL1tF}MdN-ZjCtA6L4JG*0h zO;B64E6;p0_nv#+=iEDf@8a{mtnf?Vs>b!mCzPUrpM6U4ul7Qv&I8r~Yk}7T*8sbL z8u%P=IdB5F4)_b;1;Cmzr7i|u0sJH|2D}Kk-e5EEeBj+c67>M^LgEX=pL)>DKLY$T z@G)Q|@aZzq=i6l>=a}I)RwjD9ZRUS(@Q;S>FTlmXe;U3uSTqNCIdCp;4R8r?BXA+m zzDW2!idzkEz`VbPTRHFqumbpbv_kkEt&qHV(!Be?%Yi?x5Ig@~A$nZ^r4|4y=8F6)=E`{8T=Cxxb7lQ@;Cf(u zuK4ZihW=Y~MW2zmBJV9=40!H5(XW1<*t2P#(6<=8Yo746=1IQn1YQF4=82t$f%sF8 z<8~QvXr9P9WBC5S;7<*opU)G!ehnNwN2x!V@mI0PA^#d&@EODixF2{Y(F4Cg{)O;G z!0}5Ye|`d73jD_bAFY` zSx_bP*H(#NTdO252CKwh&sIr1Uj|-B{x$Evt&%$U0C+9%;`vJ52;2f(N%=Nk^nDfB z0GymJ{v%~qQGG6udcGA1(^c;RiPt{hHKeZ@{{wItty?JdyL_S4>t^6hRL8&w@Wq89 z@12FR?w1S2{=Y61|Ce7XdS860_-o0f62};@1956G??a13zvGL9?!844hYuEszb~tn z`75hsyt7)yAFdX^9;%i)d8S(A=c z_#W_a;JaG*IZK33W{LRYDPSM)b>J?l)1^Z9#8R>U`K4m_8%u@%TW0=U;3nX&mWo{~ zm&yEX%f#;cf!70{23}2ZH1i)WllA4x1s5zA{g(mHQIgY?$G73C$9036`a9p?RiQD; zGx7=bk6Uo9HRGgz=d|_Id$%gdDf&?^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mJ>w+(IDn29EG{Q3 z$GPKEhl2@)13L$9%6CM5Fe(b==o66o_e5~?W|2Z^!aYcz7XxJOBo|aa&wz6@G;xBH zGABHOY%^R;0djCh!YA|~`-1$GgX75{i*sx{6q1&&C8@FINQ|@}&L5_K6M^Y*K1A>1 zbfa_lXz33gKCaM4a6*DWoHQ*Pp7GUXETrRzBCX|B@hNUpHXN>fsWrYIC^N&;xn%w4aJc{iA diff --git a/boards/locale/ru/LC_MESSAGES/django.po b/boards/locale/ru/LC_MESSAGES/django.po --- a/boards/locale/ru/LC_MESSAGES/django.po +++ b/boards/locale/ru/LC_MESSAGES/django.po @@ -499,3 +499,7 @@ msgstr[2] "Пожалуйста подождите %(delay)d секунд перед отправкой сообщения" msgid "New threads" msgstr "Новые темы" + +#, python-format +msgid "Max file size is %(size)s." +msgstr "Максимальный размер файла %(size)s." diff --git a/boards/templates/boards/all_threads.html b/boards/templates/boards/all_threads.html --- a/boards/templates/boards/all_threads.html +++ b/boards/templates/boards/all_threads.html @@ -148,6 +148,9 @@
{% trans 'Tags must be delimited by spaces. Text or image is required.' %} + {% with size=max_file_size|filesizeformat %} + {% blocktrans %}Max file size is {{ size }}.{% endblocktrans %} + {% endwith %}
diff --git a/boards/templates/boards/thread_normal.html b/boards/templates/boards/thread_normal.html --- a/boards/templates/boards/thread_normal.html +++ b/boards/templates/boards/thread_normal.html @@ -54,6 +54,11 @@
+
+ {% with size=max_file_size|filesizeformat %} + {% blocktrans %}Max file size is {{ size }}.{% endblocktrans %} + {% endwith %} +
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 @@ -15,6 +15,7 @@ from boards.models import Post, Thread, from boards.views.banned import BannedView from boards.views.base import BaseBoardView, CONTEXT_FORM from boards.views.posting_mixin import PostMixin +from boards.views.mixins import FileUploadMixin FORM_TAGS = 'tags' @@ -30,6 +31,7 @@ PARAMETER_PAGINATOR = 'paginator' PARAMETER_THREADS = 'threads' PARAMETER_BANNERS = 'banners' PARAMETER_ADDITIONAL = 'additional_params' +PARAMETER_MAX_FILE_SIZE = 'max_file_size' PARAMETER_PREV_LINK = 'prev_page_link' PARAMETER_NEXT_LINK = 'next_page_link' @@ -38,7 +40,7 @@ TEMPLATE = 'boards/all_threads.html' DEFAULT_PAGE = 1 -class AllThreadsView(PostMixin, BaseBoardView): +class AllThreadsView(PostMixin, FileUploadMixin, BaseBoardView): def __init__(self): self.settings_manager = None @@ -74,6 +76,7 @@ class AllThreadsView(PostMixin, BaseBoar params[PARAMETER_THREADS] = threads params[CONTEXT_FORM] = form params[PARAMETER_BANNERS] = Banner.objects.order_by('-id').all() + params[PARAMETER_MAX_FILE_SIZE] = self.get_max_upload_size() paginator.set_url(self.get_reverse_url(), request.GET.dict()) self.get_page_context(paginator, params, page) diff --git a/boards/views/mixins.py b/boards/views/mixins.py --- a/boards/views/mixins.py +++ b/boards/views/mixins.py @@ -1,3 +1,6 @@ +import boards + + PARAM_NEXT = 'next' PARAMETER_METHOD = 'method' @@ -24,3 +27,8 @@ class DispatcherMixin: if method_name: return getattr(self, method_name)(*args, **kwargs) + + +class FileUploadMixin: + def get_max_upload_size(self): + return boards.settings.get_int('Forms', 'MaxFileSize') 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,13 +1,15 @@ from boards.views.thread import ThreadView +from boards.views.mixins import FileUploadMixin TEMPLATE_NORMAL = 'boards/thread_normal.html' CONTEXT_BUMPLIMIT_PRG = 'bumplimit_progress' CONTEXT_POSTS_LEFT = 'posts_left' CONTEXT_BUMPABLE = 'bumpable' +PARAM_MAX_FILE_SIZE = 'max_file_size' -class NormalThreadView(ThreadView): +class NormalThreadView(ThreadView, FileUploadMixin): def get_template(self): return TEMPLATE_NORMAL @@ -26,5 +28,6 @@ class NormalThreadView(ThreadView): params[CONTEXT_POSTS_LEFT] = left_posts params[CONTEXT_BUMPLIMIT_PRG] = str( float(left_posts) / max_posts * 100) + params[PARAM_MAX_FILE_SIZE] = self.get_max_upload_size() return params