Show More
@@ -0,0 +1,20 b'' | |||||
|
1 | # -*- coding: utf-8 -*- | |||
|
2 | from __future__ import unicode_literals | |||
|
3 | ||||
|
4 | from django.db import models, migrations | |||
|
5 | ||||
|
6 | ||||
|
7 | class Migration(migrations.Migration): | |||
|
8 | ||||
|
9 | dependencies = [ | |||
|
10 | ('boards', '0003_remove_tag_threads'), | |||
|
11 | ] | |||
|
12 | ||||
|
13 | operations = [ | |||
|
14 | migrations.AddField( | |||
|
15 | model_name='tag', | |||
|
16 | name='required', | |||
|
17 | field=models.BooleanField(default=False), | |||
|
18 | preserve_default=True, | |||
|
19 | ), | |||
|
20 | ] |
@@ -8,7 +8,7 b' from django.utils.translation import uge' | |||||
8 |
|
8 | |||
9 | from boards.mdx_neboard import formatters |
|
9 | from boards.mdx_neboard import formatters | |
10 | from boards.models.post import TITLE_MAX_LENGTH |
|
10 | from boards.models.post import TITLE_MAX_LENGTH | |
11 | from boards.models import PostImage |
|
11 | from boards.models import PostImage, Tag | |
12 | from neboard import settings |
|
12 | from neboard import settings | |
13 | from boards import utils |
|
13 | from boards import utils | |
14 | import boards.settings as board_settings |
|
14 | import boards.settings as board_settings | |
@@ -216,6 +216,17 b' class ThreadForm(PostForm):' | |||||
216 | raise forms.ValidationError( |
|
216 | raise forms.ValidationError( | |
217 | _('Inappropriate characters in tags.')) |
|
217 | _('Inappropriate characters in tags.')) | |
218 |
|
218 | |||
|
219 | tag_models = [] | |||
|
220 | required_tag_exists = False | |||
|
221 | for tag in tags.split(): | |||
|
222 | tag_model = Tag.objects.filter(name=tag.strip().lower(), | |||
|
223 | required=True) | |||
|
224 | if tag_model.exists(): | |||
|
225 | required_tag_exists = True | |||
|
226 | ||||
|
227 | if not required_tag_exists: | |||
|
228 | raise forms.ValidationError(_('Need at least 1 required tag.')) | |||
|
229 | ||||
219 | return tags |
|
230 | return tags | |
220 |
|
231 | |||
221 | def clean(self): |
|
232 | def clean(self): |
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
@@ -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: 201 |
|
10 | "POT-Creation-Date: 2015-01-08 16:36+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" | |
@@ -41,7 +41,7 b' msgstr ""' | |||||
41 |
|
41 | |||
42 | #: forms.py:23 |
|
42 | #: forms.py:23 | |
43 | msgid "tag1 several_words_tag" |
|
43 | msgid "tag1 several_words_tag" | |
44 |
msgstr " |
|
44 | msgstr "метка1 метка_из_нескольких_слов" | |
45 |
|
45 | |||
46 | #: forms.py:25 |
|
46 | #: forms.py:25 | |
47 | msgid "Such image was already posted" |
|
47 | msgid "Such image was already posted" | |
@@ -57,9 +57,9 b' msgstr "\xd0\xa2\xd0\xb5\xd0\xba\xd1\x81\xd1\x82"' | |||||
57 |
|
57 | |||
58 | #: forms.py:29 |
|
58 | #: forms.py:29 | |
59 | msgid "Tag" |
|
59 | msgid "Tag" | |
60 |
msgstr " |
|
60 | msgstr "Метка" | |
61 |
|
61 | |||
62 |
#: forms.py:30 templates/boards/base.html: |
|
62 | #: forms.py:30 templates/boards/base.html:38 templates/search/search.html:9 | |
63 | #: templates/search/search.html.py:13 |
|
63 | #: templates/search/search.html.py:13 | |
64 | msgid "Search" |
|
64 | msgid "Search" | |
65 | msgstr "Поиск" |
|
65 | msgstr "Поиск" | |
@@ -98,21 +98,25 b' msgstr "\xd0\x9f\xd0\xbe\xd0\xb4\xd0\xbe\xd0\xb6\xd0\xb4\xd0\xb8\xd1\x82\xd0\xb5 %s \xd1\x81\xd0\xb5\xd0\xba\xd1\x83\xd0\xbd\xd0\xb4 \xd0\xbf\xd0\xbe\xd1\x81\xd0\xbb\xd0\xb5 \xd0\xbf\xd0\xbe\xd1\x81\xd0\xbb\xd0\xb5\xd0\xb4\xd0\xbd\xd0\xb5\xd0\xb3\xd0\xbe \xd0\xbf\xd0\xbe\xd1\x81\xd1\x82\xd0\xb8\xd0\xbd\xd0\xb3\xd0\xb0"' | |||||
98 |
|
98 | |||
99 | #: forms.py:210 templates/boards/rss/post.html:10 templates/boards/tags.html:7 |
|
99 | #: forms.py:210 templates/boards/rss/post.html:10 templates/boards/tags.html:7 | |
100 | msgid "Tags" |
|
100 | msgid "Tags" | |
101 |
msgstr " |
|
101 | msgstr "Метки" | |
102 |
|
102 | |||
103 |
#: forms.py:217 forms.py:24 |
|
103 | #: forms.py:217 forms.py:254 | |
104 | msgid "Inappropriate characters in tags." |
|
104 | msgid "Inappropriate characters in tags." | |
105 |
msgstr "Недопустимые символы в |
|
105 | msgstr "Недопустимые символы в метках." | |
106 |
|
106 | |||
107 |
#: forms.py:2 |
|
107 | #: forms.py:228 | |
|
108 | msgid "Need at least 1 required tag." | |||
|
109 | msgstr "Нужна хотя бы 1 обязательная метка." | |||
|
110 | ||||
|
111 | #: forms.py:241 | |||
108 | msgid "Theme" |
|
112 | msgid "Theme" | |
109 | msgstr "Тема" |
|
113 | msgstr "Тема" | |
110 |
|
114 | |||
111 |
#: forms.py:2 |
|
115 | #: forms.py:277 | |
112 | msgid "Invalid master password" |
|
116 | msgid "Invalid master password" | |
113 | msgstr "Неверный мастер-пароль" |
|
117 | msgstr "Неверный мастер-пароль" | |
114 |
|
118 | |||
115 |
#: forms.py:2 |
|
119 | #: forms.py:291 | |
116 | #, python-format |
|
120 | #, python-format | |
117 | msgid "Wait %s minutes after last login" |
|
121 | msgid "Wait %s minutes after last login" | |
118 | msgstr "Подождите %s минут после последнего входа" |
|
122 | msgstr "Подождите %s минут после последнего входа" | |
@@ -141,32 +145,32 b' msgstr "\xd0\xbb\xd0\xb8\xd1\x86\xd0\xb5\xd0\xbd\xd0\xb7\xd0\xb8\xd0\xb5\xd0\xb9"' | |||||
141 | msgid "Repository" |
|
145 | msgid "Repository" | |
142 | msgstr "Репозиторий" |
|
146 | msgstr "Репозиторий" | |
143 |
|
147 | |||
144 |
#: templates/boards/base.html:1 |
|
148 | #: templates/boards/base.html:13 | |
145 | msgid "Feed" |
|
149 | msgid "Feed" | |
146 | msgstr "Лента" |
|
150 | msgstr "Лента" | |
147 |
|
151 | |||
148 |
#: templates/boards/base.html:3 |
|
152 | #: templates/boards/base.html:30 | |
149 | msgid "All threads" |
|
153 | msgid "All threads" | |
150 | msgstr "Все темы" |
|
154 | msgstr "Все темы" | |
151 |
|
155 | |||
152 |
#: templates/boards/base.html:3 |
|
156 | #: templates/boards/base.html:36 | |
153 | msgid "Tag management" |
|
157 | msgid "Tag management" | |
154 |
msgstr "Управление |
|
158 | msgstr "Управление метками" | |
155 |
|
159 | |||
156 |
#: templates/boards/base.html: |
|
160 | #: templates/boards/base.html:39 templates/boards/settings.html:7 | |
157 | msgid "Settings" |
|
161 | msgid "Settings" | |
158 | msgstr "Настройки" |
|
162 | msgstr "Настройки" | |
159 |
|
163 | |||
160 |
#: templates/boards/base.html:5 |
|
164 | #: templates/boards/base.html:52 | |
161 | msgid "Admin" |
|
165 | msgid "Admin" | |
162 | msgstr "" |
|
166 | msgstr "" | |
163 |
|
167 | |||
164 |
#: templates/boards/base.html:5 |
|
168 | #: templates/boards/base.html:54 | |
165 | #, python-format |
|
169 | #, python-format | |
166 | msgid "Speed: %(ppd)s posts per day" |
|
170 | msgid "Speed: %(ppd)s posts per day" | |
167 | msgstr "Скорость: %(ppd)s сообщений в день" |
|
171 | msgstr "Скорость: %(ppd)s сообщений в день" | |
168 |
|
172 | |||
169 |
#: templates/boards/base.html:6 |
|
173 | #: templates/boards/base.html:56 | |
170 | msgid "Up" |
|
174 | msgid "Up" | |
171 | msgstr "Вверх" |
|
175 | msgstr "Вверх" | |
172 |
|
176 | |||
@@ -178,92 +182,96 b' msgstr "\xd0\x92\xd1\x85\xd0\xbe\xd0\xb4"' | |||||
178 | msgid "Insert your user id above" |
|
182 | msgid "Insert your user id above" | |
179 | msgstr "Вставьте свой ID пользователя выше" |
|
183 | msgstr "Вставьте свой ID пользователя выше" | |
180 |
|
184 | |||
181 |
#: templates/boards/post.html: |
|
185 | #: templates/boards/post.html:19 templates/boards/staticpages/help.html:17 | |
182 | msgid "Quote" |
|
186 | msgid "Quote" | |
183 | msgstr "Цитата" |
|
187 | msgstr "Цитата" | |
184 |
|
188 | |||
185 |
#: templates/boards/post.html: |
|
189 | #: templates/boards/post.html:27 | |
186 | msgid "Open" |
|
190 | msgid "Open" | |
187 | msgstr "Открыть" |
|
191 | msgstr "Открыть" | |
188 |
|
192 | |||
189 |
#: templates/boards/post.html: |
|
193 | #: templates/boards/post.html:29 | |
190 | msgid "Reply" |
|
194 | msgid "Reply" | |
191 | msgstr "Ответ" |
|
195 | msgstr "Ответ" | |
192 |
|
196 | |||
193 |
#: templates/boards/post.html: |
|
197 | #: templates/boards/post.html:36 | |
194 | msgid "Edit" |
|
198 | msgid "Edit" | |
195 | msgstr "Изменить" |
|
199 | msgstr "Изменить" | |
196 |
|
200 | |||
197 |
#: templates/boards/post.html: |
|
201 | #: templates/boards/post.html:39 | |
198 | msgid "Edit thread" |
|
202 | msgid "Edit thread" | |
199 | msgstr "Изменить тему" |
|
203 | msgstr "Изменить тему" | |
200 |
|
204 | |||
201 |
#: templates/boards/post.html:7 |
|
205 | #: templates/boards/post.html:71 | |
202 | msgid "Replies" |
|
206 | msgid "Replies" | |
203 | msgstr "Ответы" |
|
207 | msgstr "Ответы" | |
204 |
|
208 | |||
205 |
#: templates/boards/post.html: |
|
209 | #: templates/boards/post.html:79 templates/boards/thread.html:89 | |
206 | #: templates/boards/thread_gallery.html:59 |
|
210 | #: templates/boards/thread_gallery.html:59 | |
207 | msgid "messages" |
|
211 | msgid "messages" | |
208 | msgstr "сообщений" |
|
212 | msgstr "сообщений" | |
209 |
|
213 | |||
210 |
#: templates/boards/post.html:8 |
|
214 | #: templates/boards/post.html:80 templates/boards/thread.html:90 | |
211 | #: templates/boards/thread_gallery.html:60 |
|
215 | #: templates/boards/thread_gallery.html:60 | |
212 | msgid "images" |
|
216 | msgid "images" | |
213 | msgstr "изображений" |
|
217 | msgstr "изображений" | |
214 |
|
218 | |||
215 | #: templates/boards/post_admin.html:19 |
|
219 | #: templates/boards/post_admin.html:19 | |
216 | msgid "Tags:" |
|
220 | msgid "Tags:" | |
217 |
msgstr " |
|
221 | msgstr "Метки:" | |
218 |
|
222 | |||
219 | #: templates/boards/post_admin.html:30 |
|
223 | #: templates/boards/post_admin.html:30 | |
220 | msgid "Add tag" |
|
224 | msgid "Add tag" | |
221 |
msgstr "Добавить |
|
225 | msgstr "Добавить метку" | |
222 |
|
226 | |||
223 | #: templates/boards/posting_general.html:56 |
|
227 | #: templates/boards/posting_general.html:56 | |
224 | msgid "Show tag" |
|
228 | msgid "Show tag" | |
225 |
msgstr "Показывать |
|
229 | msgstr "Показывать метку" | |
226 |
|
230 | |||
227 | #: templates/boards/posting_general.html:60 |
|
231 | #: templates/boards/posting_general.html:60 | |
228 | msgid "Hide tag" |
|
232 | msgid "Hide tag" | |
229 |
msgstr "Скрывать |
|
233 | msgstr "Скрывать метку" | |
230 |
|
234 | |||
231 |
#: templates/boards/posting_general.html: |
|
235 | #: templates/boards/posting_general.html:66 | |
|
236 | msgid "Edit tag" | |||
|
237 | msgstr "Изменить метку" | |||
|
238 | ||||
|
239 | #: templates/boards/posting_general.html:82 templates/search/search.html:22 | |||
232 | msgid "Previous page" |
|
240 | msgid "Previous page" | |
233 | msgstr "Предыдущая страница" |
|
241 | msgstr "Предыдущая страница" | |
234 |
|
242 | |||
235 |
#: templates/boards/posting_general.html:9 |
|
243 | #: templates/boards/posting_general.html:97 | |
236 | #, python-format |
|
244 | #, python-format | |
237 | msgid "Skipped %(count)s replies. Open thread to see all replies." |
|
245 | msgid "Skipped %(count)s replies. Open thread to see all replies." | |
238 | msgstr "Пропущено %(count)s ответов. Откройте тред, чтобы увидеть все ответы." |
|
246 | msgstr "Пропущено %(count)s ответов. Откройте тред, чтобы увидеть все ответы." | |
239 |
|
247 | |||
240 |
#: templates/boards/posting_general.html:12 |
|
248 | #: templates/boards/posting_general.html:124 templates/search/search.html:33 | |
241 | msgid "Next page" |
|
249 | msgid "Next page" | |
242 | msgstr "Следующая страница" |
|
250 | msgstr "Следующая страница" | |
243 |
|
251 | |||
244 |
#: templates/boards/posting_general.html:12 |
|
252 | #: templates/boards/posting_general.html:129 | |
245 | msgid "No threads exist. Create the first one!" |
|
253 | msgid "No threads exist. Create the first one!" | |
246 | msgstr "Нет тем. Создайте первую!" |
|
254 | msgstr "Нет тем. Создайте первую!" | |
247 |
|
255 | |||
248 |
#: templates/boards/posting_general.html:13 |
|
256 | #: templates/boards/posting_general.html:135 | |
249 | msgid "Create new thread" |
|
257 | msgid "Create new thread" | |
250 | msgstr "Создать новую тему" |
|
258 | msgstr "Создать новую тему" | |
251 |
|
259 | |||
252 |
#: templates/boards/posting_general.html:1 |
|
260 | #: templates/boards/posting_general.html:140 templates/boards/preview.html:16 | |
253 |
#: templates/boards/thread.html:5 |
|
261 | #: templates/boards/thread.html:54 | |
254 | msgid "Post" |
|
262 | msgid "Post" | |
255 | msgstr "Отправить" |
|
263 | msgstr "Отправить" | |
256 |
|
264 | |||
257 |
#: templates/boards/posting_general.html:14 |
|
265 | #: templates/boards/posting_general.html:145 | |
258 | msgid "Tags must be delimited by spaces. Text or image is required." |
|
266 | msgid "Tags must be delimited by spaces. Text or image is required." | |
259 | msgstr "" |
|
267 | msgstr "" | |
260 |
" |
|
268 | "Метки должны быть разделены пробелами. Текст или изображение обязательны." | |
261 |
|
269 | |||
262 |
#: templates/boards/posting_general.html:14 |
|
270 | #: templates/boards/posting_general.html:148 templates/boards/thread.html:62 | |
263 | msgid "Text syntax" |
|
271 | msgid "Text syntax" | |
264 | msgstr "Синтаксис текста" |
|
272 | msgstr "Синтаксис текста" | |
265 |
|
273 | |||
266 |
#: templates/boards/posting_general.html:1 |
|
274 | #: templates/boards/posting_general.html:160 | |
267 | msgid "Pages:" |
|
275 | msgid "Pages:" | |
268 | msgstr "Страницы: " |
|
276 | msgstr "Страницы: " | |
269 |
|
277 | |||
@@ -281,11 +289,11 b' msgstr "\xd0\x92\xd1\x8b \xd0\xbc\xd0\xbe\xd0\xb4\xd0\xb5\xd1\x80\xd0\xb0\xd1\x82\xd0\xbe\xd1\x80."' | |||||
281 |
|
289 | |||
282 | #: templates/boards/settings.html:19 |
|
290 | #: templates/boards/settings.html:19 | |
283 | msgid "Hidden tags:" |
|
291 | msgid "Hidden tags:" | |
284 |
msgstr "Скрытые |
|
292 | msgstr "Скрытые метки:" | |
285 |
|
293 | |||
286 | #: templates/boards/settings.html:26 |
|
294 | #: templates/boards/settings.html:26 | |
287 | msgid "No hidden tags." |
|
295 | msgid "No hidden tags." | |
288 |
msgstr "Нет скрытых |
|
296 | msgstr "Нет скрытых меток." | |
289 |
|
297 | |||
290 | #: templates/boards/settings.html:35 |
|
298 | #: templates/boards/settings.html:35 | |
291 | msgid "Save" |
|
299 | msgid "Save" | |
@@ -332,36 +340,31 b' msgstr "\xd0\x9a\xd0\xbe\xd0\xbc\xd0\xbc\xd0\xb5\xd0\xbd\xd1\x82\xd0\xb0\xd1\x80\xd0\xb8\xd0\xb9"' | |||||
332 | msgid "You can try pasting the text and previewing the result here:" |
|
340 | msgid "You can try pasting the text and previewing the result here:" | |
333 | msgstr "Вы можете попробовать вставить текст и проверить результат здесь:" |
|
341 | msgstr "Вы можете попробовать вставить текст и проверить результат здесь:" | |
334 |
|
342 | |||
335 |
#: templates/boards/tags.html:2 |
|
343 | #: templates/boards/tags.html:23 | |
336 | msgid "No tags found." |
|
344 | msgid "No tags found." | |
337 |
msgstr " |
|
345 | msgstr "Метки не найдены." | |
338 |
|
346 | |||
339 |
#: templates/boards/thread.html: |
|
347 | #: templates/boards/thread.html:19 templates/boards/thread_gallery.html:19 | |
340 | msgid "Normal mode" |
|
348 | msgid "Normal mode" | |
341 | msgstr "Нормальный режим" |
|
349 | msgstr "Нормальный режим" | |
342 |
|
350 | |||
343 |
#: templates/boards/thread.html:2 |
|
351 | #: templates/boards/thread.html:20 templates/boards/thread_gallery.html:20 | |
344 | msgid "Gallery mode" |
|
352 | msgid "Gallery mode" | |
345 | msgstr "Режим галереи" |
|
353 | msgstr "Режим галереи" | |
346 |
|
354 | |||
347 |
#: templates/boards/thread.html: |
|
355 | #: templates/boards/thread.html:28 | |
348 | msgid "posts to bumplimit" |
|
356 | msgid "posts to bumplimit" | |
349 | msgstr "сообщений до бамплимита" |
|
357 | msgstr "сообщений до бамплимита" | |
350 |
|
358 | |||
351 |
#: templates/boards/thread.html: |
|
359 | #: templates/boards/thread.html:46 | |
352 | msgid "Reply to thread" |
|
360 | msgid "Reply to thread" | |
353 | msgstr "Ответить в тему" |
|
361 | msgstr "Ответить в тему" | |
354 |
|
362 | |||
355 |
#: templates/boards/thread.html: |
|
363 | #: templates/boards/thread.html:59 | |
356 | msgid "Switch mode" |
|
364 | msgid "Switch mode" | |
357 | msgstr "Переключить режим" |
|
365 | msgstr "Переключить режим" | |
358 |
|
366 | |||
359 |
#: templates/boards/thread.html:1 |
|
367 | #: templates/boards/thread.html:91 templates/boards/thread_gallery.html:61 | |
360 | msgid "Last update: " |
|
368 | msgid "Last update: " | |
361 | msgstr "Последнее обновление: " |
|
369 | msgstr "Последнее обновление: " | |
362 |
|
370 | |||
363 | #~ msgid "Delete" |
|
|||
364 | #~ msgstr "Удалить" |
|
|||
365 |
|
||||
366 | #~ msgid "Ban IP" |
|
|||
367 | #~ msgstr "Заблокировать IP" |
|
@@ -6,5 +6,13 b' class Viewable():' | |||||
6 | pass |
|
6 | pass | |
7 |
|
7 | |||
8 | def get_view(self, *args, **kwargs): |
|
8 | def get_view(self, *args, **kwargs): | |
9 | """Get an HTML view for a model""" |
|
9 | """ | |
10 | pass No newline at end of file |
|
10 | Gets an HTML view for a model | |
|
11 | """ | |||
|
12 | pass | |||
|
13 | ||||
|
14 | def get_search_view(self, *args, **kwargs): | |||
|
15 | """ | |||
|
16 | Gets an HTML view for search. | |||
|
17 | """ | |||
|
18 | pass |
@@ -340,6 +340,9 b' class Post(models.Model, Viewable):' | |||||
340 | PARAMETER_OP_ID: opening_post_id, |
|
340 | PARAMETER_OP_ID: opening_post_id, | |
341 | }) |
|
341 | }) | |
342 |
|
342 | |||
|
343 | def get_search_view(self, *args, **kwargs): | |||
|
344 | return self.get_view(args, kwargs) | |||
|
345 | ||||
343 | def get_first_image(self) -> PostImage: |
|
346 | def get_first_image(self) -> PostImage: | |
344 | return self.images.earliest('id') |
|
347 | return self.images.earliest('id') | |
345 |
|
348 |
@@ -18,7 +18,7 b' class TagManager(models.Manager):' | |||||
18 | """ |
|
18 | """ | |
19 |
|
19 | |||
20 | not_empty_tags = list() |
|
20 | not_empty_tags = list() | |
21 | tags = self.order_by('name') |
|
21 | tags = self.order_by('-required', 'name') | |
22 | for tag in tags: |
|
22 | for tag in tags: | |
23 | if tag.get_thread_count() > 0: |
|
23 | if tag.get_thread_count() > 0: | |
24 | not_empty_tags.append(tag) |
|
24 | not_empty_tags.append(tag) | |
@@ -39,6 +39,7 b' class Tag(models.Model, Viewable):' | |||||
39 | ordering = ('name',) |
|
39 | ordering = ('name',) | |
40 |
|
40 | |||
41 | name = models.CharField(max_length=100, db_index=True) |
|
41 | name = models.CharField(max_length=100, db_index=True) | |
|
42 | required = models.BooleanField(default=False) | |||
42 |
|
43 | |||
43 | def __str__(self): |
|
44 | def __str__(self): | |
44 | return self.name |
|
45 | return self.name | |
@@ -73,10 +74,21 b' class Tag(models.Model, Viewable):' | |||||
73 | def get_url(self): |
|
74 | def get_url(self): | |
74 | return reverse('tag', kwargs={'tag_name': self.name}) |
|
75 | return reverse('tag', kwargs={'tag_name': self.name}) | |
75 |
|
76 | |||
76 |
def get_ |
|
77 | def get_threads(self): | |
|
78 | return Thread.objects.filter(tags__in=[self]).order_by('-bump_time') | |||
|
79 | ||||
|
80 | def is_required(self): | |||
|
81 | return self.required | |||
|
82 | ||||
|
83 | def get_view(self): | |||
|
84 | #prefix = '##' if self.is_required() else '#' | |||
|
85 | link = '<a class="tag" href="{}">{}</a>'.format( | |||
|
86 | self.get_url(), self.name) | |||
|
87 | if self.is_required(): | |||
|
88 | link = '<b>{}</b>'.format(link) | |||
|
89 | return link | |||
|
90 | ||||
|
91 | def get_search_view(self, *args, **kwargs): | |||
77 | return render_to_string('boards/tag.html', { |
|
92 | return render_to_string('boards/tag.html', { | |
78 | 'tag': self, |
|
93 | 'tag': self, | |
79 | }) |
|
94 | }) | |
80 |
|
||||
81 | def get_threads(self): |
|
|||
82 | return Thread.objects.filter(tags__in=[self]).order_by('-bump_time') |
|
@@ -312,7 +312,6 b' function processNewPost(post) {' | |||||
312 | } |
|
312 | } | |
313 |
|
313 | |||
314 | $(document).ready(function(){ |
|
314 | $(document).ready(function(){ | |
315 | if ('WebSocket' in window) { |
|
|||
316 |
|
|
315 | if (initAutoupdate()) { | |
317 |
|
|
316 | // Post form data over AJAX | |
318 |
|
|
317 | var threadId = $('div.thread').children('.post').first().attr('id'); | |
@@ -323,7 +322,7 b' function processNewPost(post) {' | |||||
323 |
|
|
322 | beforeSubmit: function(arr, $form, options) { | |
324 |
|
|
323 | showAsErrors($('form'), gettext('Sending message...')); | |
325 |
|
|
324 | }, | |
326 |
|
|
325 | success: getThreadDiff, | |
327 |
|
|
326 | url: '/api/add_post/' + threadId + '/' | |
328 |
|
|
327 | }; | |
329 |
|
328 | |||
@@ -331,5 +330,4 b' function processNewPost(post) {' | |||||
331 |
|
330 | |||
332 |
|
|
331 | resetForm(form); | |
333 |
|
|
332 | } | |
334 | } |
|
|||
335 | }); |
|
333 | }); |
@@ -29,8 +29,9 b'' | |||||
29 | <div class="navigation_panel header"> |
|
29 | <div class="navigation_panel header"> | |
30 | <a class="link" href="{% url 'index' %}">{% trans "All threads" %}</a> |
|
30 | <a class="link" href="{% url 'index' %}">{% trans "All threads" %}</a> | |
31 | {% for tag in tags %} |
|
31 | {% for tag in tags %} | |
32 | <a class="tag" href="{% url 'tag' tag_name=tag.name %}" |
|
32 | {% autoescape off %} | |
33 | >#{{ tag.name }}</a>, |
|
33 | {{ tag.get_view }}{% if not forloop.last %},{% endif %} | |
|
34 | {% endautoescape %} | |||
34 | {% endfor %} |
|
35 | {% endfor %} | |
35 | <a href="{% url 'tags' %}" title="{% trans 'Tag management' %}" |
|
36 | <a href="{% url 'tags' %}" title="{% trans 'Tag management' %}" | |
36 | >[...]</a>, |
|
37 | >[...]</a>, |
@@ -81,8 +81,9 b'' | |||||
81 | {% endif %} |
|
81 | {% endif %} | |
82 | <span class="tags"> |
|
82 | <span class="tags"> | |
83 | {% for tag in thread.get_tags %} |
|
83 | {% for tag in thread.get_tags %} | |
84 | <a class="tag" href="{% url 'tag' tag.name %}"> |
|
84 | {% autoescape off %} | |
85 |
|
|
85 | {{ tag.get_view }}{% if not forloop.last %},{% endif %} | |
|
86 | {% endautoescape %} | |||
86 | {% endfor %} |
|
87 | {% endfor %} | |
87 | </span> |
|
88 | </span> | |
88 | </div> |
|
89 | </div> |
@@ -60,7 +60,10 b'' | |||||
60 | title="{% trans 'Hide tag' %}" |
|
60 | title="{% trans 'Hide tag' %}" | |
61 | class="not_fav" rel="nofollow">H</a> |
|
61 | class="not_fav" rel="nofollow">H</a> | |
62 | {% endif %} |
|
62 | {% endif %} | |
63 |
|
|
63 | {% autoescape off %} | |
|
64 | {{ tag.get_view }} | |||
|
65 | {% endautoescape %} | |||
|
66 | [<a href="{% url 'admin:boards_tag_change' tag.id %}"$>{% trans 'Edit tag' %}</a>] | |||
64 | </h2> |
|
67 | </h2> | |
65 | </div> |
|
68 | </div> | |
66 | {% endif %} |
|
69 | {% endif %} |
@@ -1,3 +1,5 b'' | |||||
1 | <div class="post"> |
|
1 | <div class="post"> | |
2 | <a class="tag" href="{% url 'tag' tag_name=tag.name %}">#{{ tag.name }}</a> |
|
2 | {% autoescape off %} | |
3 | </div> No newline at end of file |
|
3 | {{ tag.get_view }} | |
|
4 | {% endautoescape %} | |||
|
5 | </div> |
@@ -14,8 +14,9 b'' | |||||
14 | {% if all_tags %} |
|
14 | {% if all_tags %} | |
15 | {% for tag in all_tags %} |
|
15 | {% for tag in all_tags %} | |
16 | <div class="tag_item"> |
|
16 | <div class="tag_item"> | |
17 | <a class="tag" href="{% url 'tag' tag.name %}"> |
|
17 | {% autoescape off %} | |
18 |
|
|
18 | {{ tag.get_view }} | |
|
19 | {% endautoescape %} | |||
19 | </div> |
|
20 | </div> | |
20 | {% endfor %} |
|
21 | {% endfor %} | |
21 | {% else %} |
|
22 | {% else %} |
@@ -25,7 +25,7 b'' | |||||
25 | {% endif %} |
|
25 | {% endif %} | |
26 |
|
26 | |||
27 | {% for result in page.object_list %} |
|
27 | {% for result in page.object_list %} | |
28 | {{ result.object.get_view }} |
|
28 | {{ result.object.get_search_view }} | |
29 | {% endfor %} |
|
29 | {% endfor %} | |
30 |
|
30 | |||
31 | {% if page.has_next %} |
|
31 | {% if page.has_next %} | |
@@ -35,4 +35,4 b'' | |||||
35 | </div> |
|
35 | </div> | |
36 | {% endif %} |
|
36 | {% endif %} | |
37 | {% endif %} |
|
37 | {% endif %} | |
38 | {% endblock %} No newline at end of file |
|
38 | {% endblock %} |
@@ -1,7 +1,7 b'' | |||||
1 | from django.test import TestCase, Client |
|
1 | from django.test import TestCase, Client | |
2 | import time |
|
2 | import time | |
3 | from boards import settings |
|
3 | from boards import settings | |
4 | from boards.models import Post |
|
4 | from boards.models import Post, Tag | |
5 | import neboard |
|
5 | import neboard | |
6 |
|
6 | |||
7 |
|
7 | |||
@@ -22,6 +22,7 b' class FormTest(TestCase):' | |||||
22 |
|
22 | |||
23 | valid_tags = 'tag1 tag_2 тег_3' |
|
23 | valid_tags = 'tag1 tag_2 тег_3' | |
24 | invalid_tags = '$%_356 ---' |
|
24 | invalid_tags = '$%_356 ---' | |
|
25 | Tag.objects.create(name='tag1', required=True) | |||
25 |
|
26 | |||
26 | response = client.post(NEW_THREAD_PAGE, {'title': 'test title', |
|
27 | response = client.post(NEW_THREAD_PAGE, {'title': 'test title', | |
27 | 'text': TEST_TEXT, |
|
28 | 'text': TEST_TEXT, |
@@ -1,4 +1,4 b'' | |||||
1 | #!/usr/bin/env python |
|
1 | #!/usr/bin/env python3 | |
2 | import os |
|
2 | import os | |
3 | import sys |
|
3 | import sys | |
4 |
|
4 |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now