Show More
@@ -14,6 +14,8 b' from neboard import settings' | |||||
14 | from boards import utils |
|
14 | from boards import utils | |
15 | import boards.settings as board_settings |
|
15 | import boards.settings as board_settings | |
16 |
|
16 | |||
|
17 | VETERAN_POSTING_DELAY = 5 | |||
|
18 | ||||
17 | ATTRIBUTE_PLACEHOLDER = 'placeholder' |
|
19 | ATTRIBUTE_PLACEHOLDER = 'placeholder' | |
18 |
|
20 | |||
19 | LAST_POST_TIME = 'last_post_time' |
|
21 | LAST_POST_TIME = 'last_post_time' | |
@@ -178,15 +180,21 b' class PostForm(NeboardForm):' | |||||
178 | def _validate_posting_speed(self): |
|
180 | def _validate_posting_speed(self): | |
179 | can_post = True |
|
181 | can_post = True | |
180 |
|
182 | |||
|
183 | user = User.objects.get(id=self.session['user_id']) | |||
|
184 | if user.is_veteran(): | |||
|
185 | posting_delay = VETERAN_POSTING_DELAY | |||
|
186 | else: | |||
|
187 | posting_delay = settings.POSTING_DELAY | |||
|
188 | ||||
181 | if LAST_POST_TIME in self.session: |
|
189 | if LAST_POST_TIME in self.session: | |
182 | now = time.time() |
|
190 | now = time.time() | |
183 | last_post_time = self.session[LAST_POST_TIME] |
|
191 | last_post_time = self.session[LAST_POST_TIME] | |
184 |
|
192 | |||
185 | current_delay = int(now - last_post_time) |
|
193 | current_delay = int(now - last_post_time) | |
186 |
|
194 | |||
187 |
if current_delay < |
|
195 | if current_delay < posting_delay: | |
188 | error_message = _('Wait %s seconds after last posting') % str( |
|
196 | error_message = _('Wait %s seconds after last posting') % str( | |
189 |
|
|
197 | posting_delay - current_delay) | |
190 | self._errors['text'] = self.error_class([error_message]) |
|
198 | self._errors['text'] = self.error_class([error_message]) | |
191 |
|
199 | |||
192 | can_post = False |
|
200 | can_post = False |
@@ -7,7 +7,7 b' msgid ""' | |||||
7 | msgstr "" |
|
7 | msgstr "" | |
8 | "Project-Id-Version: PACKAGE VERSION\n" |
|
8 | "Project-Id-Version: PACKAGE VERSION\n" | |
9 | "Report-Msgid-Bugs-To: \n" |
|
9 | "Report-Msgid-Bugs-To: \n" | |
10 |
"POT-Creation-Date: 2014-0 |
|
10 | "POT-Creation-Date: 2014-03-08 12:24+0200\n" | |
11 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
|
11 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | |
12 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
|
12 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | |
13 | "Language-Team: LANGUAGE <LL@li.org>\n" |
|
13 | "Language-Team: LANGUAGE <LL@li.org>\n" | |
@@ -89,36 +89,36 b' msgstr "\xd0\x98\xd0\xb7\xd0\xbe\xd0\xb1\xd1\x80\xd0\xb0\xd0\xb6\xd0\xb5\xd0\xbd\xd0\xb8\xd0\xb5 \xd0\xb4\xd0\xbe\xd0\xbb\xd0\xb6\xd0\xbd\xd0\xbe \xd0\xb1\xd1\x8b\xd1\x82\xd1\x8c \xd0\xbc\xd0\xb5\xd0\xbd\xd0\xb5\xd0\xb5 %s \xd0\xb1\xd0\xb0\xd0\xb9\xd1\x82"' | |||||
89 | msgid "Either text or image must be entered." |
|
89 | msgid "Either text or image must be entered." | |
90 | msgstr "Текст или картинка должны быть введены." |
|
90 | msgstr "Текст или картинка должны быть введены." | |
91 |
|
91 | |||
92 |
#: forms.py:1 |
|
92 | #: forms.py:193 | |
93 | #, python-format |
|
93 | #, python-format | |
94 | msgid "Wait %s seconds after last posting" |
|
94 | msgid "Wait %s seconds after last posting" | |
95 | msgstr "Подождите %s секунд после последнего постинга" |
|
95 | msgstr "Подождите %s секунд после последнего постинга" | |
96 |
|
96 | |||
97 |
#: forms.py:20 |
|
97 | #: forms.py:209 templates/boards/tags.html:7 templates/boards/rss/post.html:10 | |
98 | msgid "Tags" |
|
98 | msgid "Tags" | |
99 | msgstr "Теги" |
|
99 | msgstr "Теги" | |
100 |
|
100 | |||
101 |
#: forms.py:21 |
|
101 | #: forms.py:217 forms.py:336 | |
102 | msgid "Inappropriate characters in tags." |
|
102 | msgid "Inappropriate characters in tags." | |
103 | msgstr "Недопустимые символы в тегах." |
|
103 | msgstr "Недопустимые символы в тегах." | |
104 |
|
104 | |||
105 |
#: forms.py:24 |
|
105 | #: forms.py:245 forms.py:266 | |
106 | msgid "Captcha validation failed" |
|
106 | msgid "Captcha validation failed" | |
107 | msgstr "Проверка капчи провалена" |
|
107 | msgstr "Проверка капчи провалена" | |
108 |
|
108 | |||
109 |
#: forms.py:2 |
|
109 | #: forms.py:272 | |
110 | msgid "Theme" |
|
110 | msgid "Theme" | |
111 | msgstr "Тема" |
|
111 | msgstr "Тема" | |
112 |
|
112 | |||
113 |
#: forms.py:27 |
|
113 | #: forms.py:277 | |
114 | msgid "Enable moderation panel" |
|
114 | msgid "Enable moderation panel" | |
115 | msgstr "Включить панель модерации" |
|
115 | msgstr "Включить панель модерации" | |
116 |
|
116 | |||
117 |
#: forms.py:2 |
|
117 | #: forms.py:292 | |
118 | msgid "No such user found" |
|
118 | msgid "No such user found" | |
119 | msgstr "Данный пользователь не найден" |
|
119 | msgstr "Данный пользователь не найден" | |
120 |
|
120 | |||
121 |
#: forms.py:30 |
|
121 | #: forms.py:306 | |
122 | #, python-format |
|
122 | #, python-format | |
123 | msgid "Wait %s minutes after last login" |
|
123 | msgid "Wait %s minutes after last login" | |
124 | msgstr "Подождите %s минут после последнего входа" |
|
124 | msgstr "Подождите %s минут после последнего входа" | |
@@ -281,22 +281,26 b' msgid "You are moderator."' | |||||
281 | msgstr "Вы модератор." |
|
281 | msgstr "Вы модератор." | |
282 |
|
282 | |||
283 | #: templates/boards/settings.html:19 |
|
283 | #: templates/boards/settings.html:19 | |
|
284 | msgid "You are veteran." | |||
|
285 | msgstr "Вы ветеран." | |||
|
286 | ||||
|
287 | #: templates/boards/settings.html:22 | |||
284 | msgid "Posts:" |
|
288 | msgid "Posts:" | |
285 | msgstr "Сообщений:" |
|
289 | msgstr "Сообщений:" | |
286 |
|
290 | |||
287 |
#: templates/boards/settings.html:2 |
|
291 | #: templates/boards/settings.html:23 | |
288 | msgid "First access:" |
|
292 | msgid "First access:" | |
289 | msgstr "Первый доступ:" |
|
293 | msgstr "Первый доступ:" | |
290 |
|
294 | |||
291 |
#: templates/boards/settings.html:2 |
|
295 | #: templates/boards/settings.html:25 | |
292 | msgid "Last access:" |
|
296 | msgid "Last access:" | |
293 | msgstr "Последний доступ: " |
|
297 | msgstr "Последний доступ: " | |
294 |
|
298 | |||
295 |
#: templates/boards/settings.html:2 |
|
299 | #: templates/boards/settings.html:29 | |
296 | msgid "Hidden tags:" |
|
300 | msgid "Hidden tags:" | |
297 | msgstr "Скрытые теги:" |
|
301 | msgstr "Скрытые теги:" | |
298 |
|
302 | |||
299 |
#: templates/boards/settings.html:4 |
|
303 | #: templates/boards/settings.html:44 | |
300 | msgid "Save" |
|
304 | msgid "Save" | |
301 | msgstr "Сохранить" |
|
305 | msgstr "Сохранить" | |
302 |
|
306 |
@@ -13,6 +13,8 b' RANK_USER = 100' | |||||
13 | BAN_REASON_AUTO = 'Auto' |
|
13 | BAN_REASON_AUTO = 'Auto' | |
14 | BAN_REASON_MAX_LENGTH = 200 |
|
14 | BAN_REASON_MAX_LENGTH = 200 | |
15 |
|
15 | |||
|
16 | VETERAN_POSTS = 1000 | |||
|
17 | ||||
16 |
|
18 | |||
17 | class User(models.Model): |
|
19 | class User(models.Model): | |
18 |
|
20 | |||
@@ -95,6 +97,13 b' class User(models.Model):' | |||||
95 | def unhide_tag(self, tag): |
|
97 | def unhide_tag(self, tag): | |
96 | self.hidden_tags.remove(tag) |
|
98 | self.hidden_tags.remove(tag) | |
97 |
|
99 | |||
|
100 | def is_veteran(self): | |||
|
101 | """ | |||
|
102 | Returns if a user is old (veteran). | |||
|
103 | """ | |||
|
104 | ||||
|
105 | return self.get_post_count() >= VETERAN_POSTS | |||
|
106 | ||||
98 | def _get_tag_cache_key(self): |
|
107 | def _get_tag_cache_key(self): | |
99 | return self.user_id + '_tags' |
|
108 | return self.user_id + '_tags' | |
100 |
|
109 |
@@ -15,6 +15,9 b'' | |||||
15 | {% if user.is_moderator %} |
|
15 | {% if user.is_moderator %} | |
16 | {% trans 'You are moderator.' %} |
|
16 | {% trans 'You are moderator.' %} | |
17 | {% endif %} |
|
17 | {% endif %} | |
|
18 | {% if user.is_veteran %} | |||
|
19 | {% trans 'You are veteran.' %} | |||
|
20 | {% endif %} | |||
18 | </p> |
|
21 | </p> | |
19 | <p>{% trans 'Posts:' %} {{ user.get_post_count }}</p> |
|
22 | <p>{% trans 'Posts:' %} {{ user.get_post_count }}</p> | |
20 | <p>{% trans 'First access:' %} {{ user.registration_time|naturaltime }}</p> |
|
23 | <p>{% trans 'First access:' %} {{ user.registration_time|naturaltime }}</p> |
General Comments 0
You need to be logged in to leave comments.
Login now