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