# HG changeset patch # User neko259 # Date 2013-11-24 14:58:42 # Node ID 33667f743d7e767eb0bf885f2139387555e29a64 # Parent c7fb6785875f95adacaeacdada8ac20d4e6b43ee Show posts per diff --git a/boards/locale/ru/LC_MESSAGES/django.mo b/boards/locale/ru/LC_MESSAGES/django.mo index 9fc3d4ed0bcce068a21d6d8df33925519e06efff..95d85d6ccb6213fb62ad9b8bb426eb5ce9bcb81a GIT binary patch literal 5894 zc$|$^e{fV+6~0O>$zp&6k}9@(sY0Q++uiW93jqRIU?mBWgm!S$&dcsg^2p}B?R#&L zboxh=$PY~{4z{C%gF;)Yoza;P5=h9eKeeMHZ^w>xMy;cce{|GV#~F1xGWwl+?q)Zz zsGIEj-hKDnbIsquHXR07`yei-;SZC8a$HL!Lm+dTrT1xA4DfK9*$fG2>oQ+j;4lGlHylJovaCGYzS;D>;3>G3}*Ij`G5lvJz>@qQaZ zJRc1)pWA>B1D_0W9M1sbz^{Zjo*#vH-&=b98zIi)S0U!>58CcsjeiHOrhT=2%`*18 zW*P4rUdGQiYuu@EKk&x;gg6XLP(7=d$7B`P^>`KQu&avm{37sUR3~5rI18);{;7)d zS+bmYT)&)o*a|!Z{2VY!I$F;4c@wyX^t+t(e|tImS%b~@17pB#z#MQl@cSz`jz6wo z9agRsVk2-9@DspeE192XfFB1A0k;FcyOP)a1{kJ&fU9U-HS@Dao|@VfS)A3_52%kocC`v{-us} z`fniQrk;^rh~tBTdx}033+1_0aQ-ps9l?9=(>A2rPYKS0VtfqWW<5umB7W$s+k$U{ zD1NA3blxTf$4DPK1J{bhpFJ8WUg{mZynHb17Jh^r164TCz8BxKrO#|9lkR$M1-b`h(62>MN@4u97+GNjj(MOP)0e?j`!{ z5Zo6ndQ83ZXo)Rp|A4+%ucCUHv20Uzx~9?V$u7s0hP2HusHYLpn8`@L2XkppH0Jys z$MwWM!dg6OTITGu>0;g#2@6+OIhTmb>NC1c*_ZQt*=b7nGhH(s5eeJq z%;33$WxQ+Fu+5A(U}EP3mJ4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B+F=D=BjMdSrDS!96su(( zk;O)!Dv|xXmJT9YtE?Bf2<9l$l0fsrl>E1_c3wRkEA&fw&D=>!{yg_$DNj>z?sDR1 zSaEbOhF+!36d9u&!ZvMBXWuk zEwZ|)mat+*%KezSO9WH2zb?lJxtLe}ripcRDx%-{Xq!digLg^x3LPV=BW{wc^8<8H z6{w#s@~nFZoi(|jh!Sa(J%W^%8!EVI)=S|?y{aB5Z_v!$N8Duj1A-o%S8od~SFOR9 ziusiID#V24CC5pD;*o$6PWgguTIfXY-aunj=I(M(wFYt>je_H&P>3^0V|*gkx-`?iA7u2in8u`3H^p?J>RFkQ< z+i3nA{qO~w\n" "Language-Team: LANGUAGE \n" @@ -34,77 +34,77 @@ msgstr "разработчик javascript" msgid "designer" msgstr "дизайнер" -#: forms.py:47 templates/boards/posting_general.html:184 -#: templates/boards/thread.html:103 +#: forms.py:48 templates/boards/posting_general.html:206 +#: templates/boards/thread.html:101 msgid "Title" msgstr "Заголовок" -#: forms.py:49 templates/boards/posting_general.html:199 -#: templates/boards/thread.html:118 +#: forms.py:50 templates/boards/posting_general.html:221 +#: templates/boards/thread.html:116 msgid "Text" msgstr "Текст" -#: forms.py:50 templates/boards/posting_general.html:204 -#: templates/boards/thread.html:123 +#: forms.py:51 templates/boards/posting_general.html:226 +#: templates/boards/thread.html:121 msgid "Image" msgstr "Изображение" -#: forms.py:53 templates/boards/posting_general.html:214 -#: templates/boards/thread.html:128 +#: forms.py:54 templates/boards/posting_general.html:236 +#: templates/boards/thread.html:126 msgid "e-mail" msgstr "" -#: forms.py:64 +#: forms.py:65 #, python-format msgid "Title must have less than %s characters" msgstr "Заголовок должен иметь меньше %s символов" -#: forms.py:73 +#: forms.py:74 #, python-format msgid "Text must have less than %s characters" msgstr "Текст должен быть короче %s символов" -#: forms.py:84 +#: forms.py:85 #, python-format msgid "Image must be less than %s bytes" msgstr "Изображение должно быть менее %s байт" -#: forms.py:111 +#: forms.py:112 msgid "Either text or image must be entered." msgstr "Текст или картинка должны быть введены." -#: forms.py:124 +#: forms.py:125 #, python-format msgid "Wait %s seconds after last posting" msgstr "Подождите %s секунд после последнего постинга" -#: forms.py:138 templates/boards/post.html:39 -#: templates/boards/posting_general.html:209 templates/boards/tags.html:7 +#: forms.py:139 templates/boards/post.html:60 +#: templates/boards/posting_general.html:231 templates/boards/tags.html:6 #: templates/boards/rss/post.html:10 msgid "Tags" msgstr "Теги" -#: forms.py:146 +#: forms.py:147 msgid "Inappropriate characters in tags." msgstr "Недопустимые символы в тегах." -#: forms.py:174 forms.py:195 +#: forms.py:175 forms.py:196 msgid "Captcha validation failed" msgstr "Проверка капчи провалена" -#: forms.py:201 +#: forms.py:202 msgid "Theme" msgstr "Тема" -#: forms.py:206 +#: forms.py:207 msgid "Enable moderation panel" msgstr "Включить панель модерации" -#: forms.py:221 +#: forms.py:222 msgid "No such user found" msgstr "Данный пользователь не найден" -#: forms.py:235 +#: forms.py:236 #, python-format msgid "Wait %s minutes after last login" msgstr "Подождите %s минут после последнего входа" @@ -137,24 +137,29 @@ msgstr "Репозиторий" msgid "Feed" msgstr "Лента" -#: templates/boards/base.html:34 +#: templates/boards/base.html:35 msgid "All threads" msgstr "Все темы" -#: templates/boards/base.html:39 +#: templates/boards/base.html:40 msgid "Tag management" msgstr "Управление тегами" -#: templates/boards/base.html:41 +#: templates/boards/base.html:42 msgid "Settings" msgstr "Настройки" -#: templates/boards/base.html:48 templates/boards/login.html:6 +#: templates/boards/base.html:49 templates/boards/login.html:6 #: templates/boards/login.html.py:21 msgid "Login" msgstr "Вход" -#: templates/boards/base.html:49 +#: templates/boards/base.html:50 +#, python-format +msgid "Speed: %(posts_per_day)s posts per day" +msgstr "Скорость: %(posts_per_day)s сообщений в день" + +#: templates/boards/base.html:51 msgid "Up" msgstr "Вверх" @@ -166,91 +171,87 @@ msgstr "ID пользователя" msgid "Insert your user id above" msgstr "Вставьте свой ID пользователя выше" -#: templates/boards/post.html:10 templates/boards/rss/post.html:5 -msgid "Post image" -msgstr "Изображение сообщения" - -#: templates/boards/post.html:26 templates/boards/posting_general.html:79 -#: templates/boards/thread.html:60 +#: templates/boards/post.html:34 templates/boards/posting_general.html:100 +#: templates/boards/thread.html:59 msgid "Delete" msgstr "Удалить" -#: templates/boards/post.html:29 templates/boards/posting_general.html:82 -#: templates/boards/thread.html:63 +#: templates/boards/post.html:37 templates/boards/posting_general.html:104 +#: templates/boards/thread.html:62 msgid "Ban IP" msgstr "Заблокировать IP" -#: templates/boards/posting_general.html:44 +#: templates/boards/post.html:50 templates/boards/posting_general.html:113 +#: templates/boards/posting_general.html:169 templates/boards/thread.html:71 +msgid "Replies" +msgstr "Ответы" + +#: templates/boards/posting_general.html:63 msgid "Previous page" msgstr "Предыдущая страница" -#: templates/boards/posting_general.html:74 +#: templates/boards/posting_general.html:94 msgid "Reply" msgstr "Ответ" -#: templates/boards/posting_general.html:91 -#: templates/boards/posting_general.html:147 templates/boards/thread.html:72 -msgid "Replies" -msgstr "Ответы" - -#: templates/boards/posting_general.html:100 templates/boards/thread.html:156 +#: templates/boards/posting_general.html:122 templates/boards/thread.html:154 msgid "replies" msgstr "ответов" -#: templates/boards/posting_general.html:101 templates/boards/thread.html:157 +#: templates/boards/posting_general.html:123 templates/boards/thread.html:155 msgid "images" msgstr "изображений" -#: templates/boards/posting_general.html:170 +#: templates/boards/posting_general.html:192 msgid "Next page" msgstr "Следующая страница" -#: templates/boards/posting_general.html:175 +#: templates/boards/posting_general.html:197 msgid "No threads exist. Create the first one!" msgstr "Нет тем. Создайте первую!" -#: templates/boards/posting_general.html:181 +#: templates/boards/posting_general.html:203 msgid "Create new thread" msgstr "Создать новую тему" -#: templates/boards/posting_general.html:189 templates/boards/thread.html:108 +#: templates/boards/posting_general.html:211 templates/boards/thread.html:106 msgid "Formatting" msgstr "Форматирование" -#: templates/boards/posting_general.html:191 templates/boards/thread.html:110 +#: templates/boards/posting_general.html:213 templates/boards/thread.html:108 msgid "quote" msgstr "цитата" -#: templates/boards/posting_general.html:192 templates/boards/thread.html:111 +#: templates/boards/posting_general.html:214 templates/boards/thread.html:109 msgid "italic" msgstr "курсив" -#: templates/boards/posting_general.html:193 templates/boards/thread.html:112 +#: templates/boards/posting_general.html:215 templates/boards/thread.html:110 msgid "bold" msgstr "полужирный" -#: templates/boards/posting_general.html:194 templates/boards/thread.html:113 +#: templates/boards/posting_general.html:216 templates/boards/thread.html:111 msgid "spoiler" msgstr "спойлер" -#: templates/boards/posting_general.html:195 templates/boards/thread.html:114 +#: templates/boards/posting_general.html:217 templates/boards/thread.html:112 msgid "comment" msgstr "комментарий" -#: templates/boards/posting_general.html:227 templates/boards/thread.html:142 +#: templates/boards/posting_general.html:249 templates/boards/thread.html:140 msgid "Post" msgstr "Отправить" -#: templates/boards/posting_general.html:229 +#: templates/boards/posting_general.html:251 msgid "Tags must be delimited by spaces. Text or image is required." msgstr "" "Теги должны быть разделены пробелами. Текст или изображение обязательны." -#: templates/boards/posting_general.html:232 templates/boards/thread.html:144 +#: templates/boards/posting_general.html:254 templates/boards/thread.html:142 msgid "Text syntax" msgstr "Синтаксис текста" -#: templates/boards/posting_general.html:242 +#: templates/boards/posting_general.html:264 msgid "Pages:" msgstr "Страницы: " @@ -286,18 +287,22 @@ msgstr "тем" msgid "No tags found." msgstr "Теги не найдены." -#: templates/boards/thread.html:25 +#: templates/boards/thread.html:24 msgid "posts to bumplimit" msgstr "сообщений до бамплимита" -#: templates/boards/thread.html:100 +#: templates/boards/thread.html:98 msgid "Reply to thread" msgstr "Ответить в тему" -#: templates/boards/thread.html:158 +#: templates/boards/thread.html:156 msgid "Last update: " msgstr "Последнее обновление: " +#: templates/boards/rss/post.html:5 +msgid "Post image" +msgstr "Изображение сообщения" + #: templates/boards/staticpages/banned.html:6 msgid "Banned" msgstr "Заблокирован" diff --git a/boards/models/post.py b/boards/models/post.py --- a/boards/models/post.py +++ b/boards/models/post.py @@ -1,3 +1,5 @@ +from datetime import datetime, timedelta +from datetime import time as dtime import os from random import random import time @@ -151,6 +153,17 @@ class PostManager(models.Manager): def _get_page_count(self, thread_count): return int(math.ceil(thread_count / float(settings.THREADS_PER_PAGE))) + def get_posts_per_day(self): + """Get count of posts for the current day""" + + today = datetime.now().date() + tomorrow = today + timedelta(1) + today_start = datetime.combine(today, dtime()) + today_end = datetime.combine(tomorrow, dtime()) + + return self.filter(pub_time__lte=today_end, pub_time__gte=today_start)\ + .count() + class Post(models.Model): """A post is a message.""" diff --git a/boards/templates/boards/base.html b/boards/templates/boards/base.html --- a/boards/templates/boards/base.html +++ b/boards/templates/boards/base.html @@ -47,6 +47,7 @@ diff --git a/boards/views.py b/boards/views.py --- a/boards/views.py +++ b/boards/views.py @@ -478,6 +478,7 @@ def _init_default_context(request): user = _get_user(request) context['user'] = user context['tags'] = user.get_sorted_fav_tags() + context['posts_per_day'] = Post.objects.get_posts_per_day() theme = _get_theme(request, user) context['theme'] = theme diff --git a/todo.txt b/todo.txt --- a/todo.txt +++ b/todo.txt @@ -9,8 +9,9 @@ denied". Use second only for autoban for [DONE] Clean up tests and make them run ALWAYS [DONE] Use transactions in tests [DONE] Thread autoupdate (JS + API) -[IN PROGRESS] Split up post model into post and thread, +[DONE] Split up post model into post and thread, and move everything that is used only in 1st post to thread model. +[DONE] Show board speed in the lower panel (posts per day) [NOT STARTED] Tree view (JS) [NOT STARTED] Adding tags to images filename @@ -20,7 +21,6 @@ and move everything that is used only in [NOT STARTED] Notification engine [NOT STARTED] Javascript disabling engine [NOT STARTED] Group tags by first letter in all tags list -[NOT STARTED] Show board speed in the lower panel (posts per day) [NOT STARTED] Character counter in the post field [NOT STARTED] Save image thumbnails size to the separate field [NOT STARTED] Whitelist functionality. Permin autoban of an address