Show More
|
1 | NO CONTENT: modified file, binary diff hidden |
@@ -1,438 +1,440 b'' | |||
|
1 | 1 | # SOME DESCRIPTIVE TITLE. |
|
2 | 2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER |
|
3 | 3 | # This file is distributed under the same license as the PACKAGE package. |
|
4 | 4 | # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. |
|
5 | 5 | # |
|
6 | 6 | msgid "" |
|
7 | 7 | msgstr "" |
|
8 | 8 | "Project-Id-Version: PACKAGE VERSION\n" |
|
9 | 9 | "Report-Msgid-Bugs-To: \n" |
|
10 |
"POT-Creation-Date: 2015-08-0 |
|
|
10 | "POT-Creation-Date: 2015-08-10 10:22+0300\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" |
|
14 | 14 | "Language: ru\n" |
|
15 | 15 | "MIME-Version: 1.0\n" |
|
16 | 16 | "Content-Type: text/plain; charset=UTF-8\n" |
|
17 | 17 | "Content-Transfer-Encoding: 8bit\n" |
|
18 | 18 | "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" |
|
19 | 19 | "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" |
|
20 | 20 | |
|
21 | 21 | #: admin.py:22 |
|
22 | 22 | msgid "{} posters were banned" |
|
23 | 23 | msgstr "" |
|
24 | 24 | |
|
25 | 25 | #: authors.py:9 |
|
26 | 26 | msgid "author" |
|
27 | 27 | msgstr "автор" |
|
28 | 28 | |
|
29 | 29 | #: authors.py:10 |
|
30 | 30 | msgid "developer" |
|
31 | 31 | msgstr "разработчик" |
|
32 | 32 | |
|
33 | 33 | #: authors.py:11 |
|
34 | 34 | msgid "javascript developer" |
|
35 | 35 | msgstr "разработчик javascript" |
|
36 | 36 | |
|
37 | 37 | #: authors.py:12 |
|
38 | 38 | msgid "designer" |
|
39 | 39 | msgstr "дизайнер" |
|
40 | 40 | |
|
41 | 41 | #: forms.py:38 |
|
42 | 42 | msgid "Type message here. Use formatting panel for more advanced usage." |
|
43 | 43 | msgstr "" |
|
44 | 44 | "Вводите сообщение сюда. Используйте панель для более сложного форматирования." |
|
45 | 45 | |
|
46 | 46 | #: forms.py:39 |
|
47 | 47 | msgid "music images i_dont_like_tags" |
|
48 | 48 | msgstr "музыка картинки теги_не_нужны" |
|
49 | 49 | |
|
50 | 50 | #: forms.py:41 |
|
51 | 51 | msgid "Title" |
|
52 | 52 | msgstr "Заголовок" |
|
53 | 53 | |
|
54 | 54 | #: forms.py:42 |
|
55 | 55 | msgid "Text" |
|
56 | 56 | msgstr "Текст" |
|
57 | 57 | |
|
58 | 58 | #: forms.py:43 |
|
59 | 59 | msgid "Tag" |
|
60 | 60 | msgstr "Метка" |
|
61 | 61 | |
|
62 | 62 | #: forms.py:44 templates/boards/base.html:40 templates/search/search.html:7 |
|
63 | 63 | msgid "Search" |
|
64 | 64 | msgstr "Поиск" |
|
65 | 65 | |
|
66 | 66 | #: forms.py:46 |
|
67 | 67 | #, python-format |
|
68 | 68 | msgid "Please wait %s seconds before sending message" |
|
69 | 69 | msgstr "Пожалуйста подождите %s секунд перед отправкой сообщения" |
|
70 | 70 | |
|
71 | 71 | #: forms.py:147 |
|
72 | 72 | msgid "Image" |
|
73 | 73 | msgstr "Изображение" |
|
74 | 74 | |
|
75 | 75 | #: forms.py:150 |
|
76 | 76 | msgid "Image URL" |
|
77 | 77 | msgstr "URL изображения" |
|
78 | 78 | |
|
79 | 79 | #: forms.py:156 |
|
80 | 80 | msgid "e-mail" |
|
81 | 81 | msgstr "" |
|
82 | 82 | |
|
83 | 83 | #: forms.py:159 |
|
84 | 84 | msgid "Additional threads" |
|
85 | 85 | msgstr "Дополнительные темы" |
|
86 | 86 | |
|
87 | 87 | #: forms.py:170 |
|
88 | 88 | #, python-format |
|
89 | 89 | msgid "Title must have less than %s characters" |
|
90 | 90 | msgstr "Заголовок должен иметь меньше %s символов" |
|
91 | 91 | |
|
92 | 92 | #: forms.py:180 |
|
93 | 93 | #, python-format |
|
94 | 94 | msgid "Text must have less than %s characters" |
|
95 | 95 | msgstr "Текст должен быть короче %s символов" |
|
96 | 96 | |
|
97 | 97 | #: forms.py:200 |
|
98 | 98 | msgid "Invalid URL" |
|
99 | 99 | msgstr "Неверный URL" |
|
100 | 100 | |
|
101 | 101 | #: forms.py:221 |
|
102 | 102 | msgid "Invalid additional thread list" |
|
103 | 103 | msgstr "Неверный список дополнительных тем" |
|
104 | 104 | |
|
105 | 105 | #: forms.py:253 |
|
106 | 106 | msgid "Either text or image must be entered." |
|
107 | 107 | msgstr "Текст или картинка должны быть введены." |
|
108 | 108 | |
|
109 | 109 | #: forms.py:291 |
|
110 | 110 | #, python-format |
|
111 | 111 | msgid "Image must be less than %s bytes" |
|
112 | 112 | msgstr "Изображение должно быть менее %s байт" |
|
113 | 113 | |
|
114 | 114 | #: forms.py:338 templates/boards/all_threads.html:141 |
|
115 | 115 | #: templates/boards/rss/post.html:10 templates/boards/tags.html:6 |
|
116 | 116 | msgid "Tags" |
|
117 | 117 | msgstr "Метки" |
|
118 | 118 | |
|
119 | 119 | #: forms.py:345 |
|
120 | 120 | msgid "Inappropriate characters in tags." |
|
121 | 121 | msgstr "Недопустимые символы в метках." |
|
122 | 122 | |
|
123 | 123 | #: forms.py:359 |
|
124 | #| msgid "Need at least one of the tags: " | |
|
125 | 124 | msgid "Need at least one section." |
|
126 | 125 | msgstr "Нужен хотя бы один раздел." |
|
127 | 126 | |
|
128 | 127 | #: forms.py:371 |
|
129 | 128 | msgid "Theme" |
|
130 | 129 | msgstr "Тема" |
|
131 | 130 | |
|
132 | 131 | #: forms.py:372 |
|
133 | 132 | msgid "Image view mode" |
|
134 | 133 | msgstr "Режим просмотра изображений" |
|
135 | 134 | |
|
136 | 135 | #: forms.py:373 |
|
137 | 136 | msgid "User name" |
|
138 | 137 | msgstr "Имя пользователя" |
|
139 | 138 | |
|
140 | 139 | #: forms.py:374 |
|
141 | 140 | msgid "Time zone" |
|
142 | 141 | msgstr "Часовой пояс" |
|
143 | 142 | |
|
144 | 143 | #: forms.py:380 |
|
145 | 144 | msgid "Inappropriate characters." |
|
146 | 145 | msgstr "Недопустимые символы." |
|
147 | 146 | |
|
148 | 147 | #: templates/boards/404.html:6 |
|
149 | 148 | msgid "Not found" |
|
150 | 149 | msgstr "Не найдено" |
|
151 | 150 | |
|
152 | 151 | #: templates/boards/404.html:12 |
|
153 | 152 | msgid "This page does not exist" |
|
154 | 153 | msgstr "Этой страницы не существует" |
|
155 | 154 | |
|
156 | 155 | #: templates/boards/all_threads.html:35 |
|
157 | 156 | msgid "Related message" |
|
158 | 157 | msgstr "Связанное сообщение" |
|
159 | 158 | |
|
160 | 159 | #: templates/boards/all_threads.html:68 |
|
161 | 160 | msgid "Edit tag" |
|
162 | 161 | msgstr "Изменить метку" |
|
163 | 162 | |
|
164 | 163 | #: templates/boards/all_threads.html:76 |
|
165 | 164 | #, python-format |
|
166 | msgid "This tag has %(thread_count)s threads and %(post_count)s posts." | |
|
167 | msgstr "С этой меткой есть %(thread_count)s тем и %(post_count)s сообщений." | |
|
165 | #| msgid "This tag has %(thread_count)s threads and %(post_count)s posts." | |
|
166 | msgid "" | |
|
167 | "This tag has %(active_thread_count)s/%(thread_count)s threads and " | |
|
168 | "%(post_count)s posts." | |
|
169 | msgstr "С этой меткой есть %(active_thread_count)s/%(thread_count)s тем и %(post_count)s сообщений." | |
|
168 | 170 | |
|
169 | 171 | #: templates/boards/all_threads.html:83 templates/boards/feed.html:30 |
|
170 | 172 | #: templates/boards/notifications.html:17 templates/search/search.html:26 |
|
171 | 173 | msgid "Previous page" |
|
172 | 174 | msgstr "Предыдущая страница" |
|
173 | 175 | |
|
174 | 176 | #: templates/boards/all_threads.html:97 |
|
175 | 177 | #, python-format |
|
176 | 178 | msgid "Skipped %(count)s replies. Open thread to see all replies." |
|
177 | 179 | msgstr "Пропущено %(count)s ответов. Откройте тред, чтобы увидеть все ответы." |
|
178 | 180 | |
|
179 | 181 | #: templates/boards/all_threads.html:115 templates/boards/feed.html:40 |
|
180 | 182 | #: templates/boards/notifications.html:27 templates/search/search.html:37 |
|
181 | 183 | msgid "Next page" |
|
182 | 184 | msgstr "Следующая страница" |
|
183 | 185 | |
|
184 | 186 | #: templates/boards/all_threads.html:120 |
|
185 | 187 | msgid "No threads exist. Create the first one!" |
|
186 | 188 | msgstr "Нет тем. Создайте первую!" |
|
187 | 189 | |
|
188 | 190 | #: templates/boards/all_threads.html:126 |
|
189 | 191 | msgid "Create new thread" |
|
190 | 192 | msgstr "Создать новую тему" |
|
191 | 193 | |
|
192 | 194 | #: templates/boards/all_threads.html:131 templates/boards/preview.html:16 |
|
193 | 195 | #: templates/boards/thread_normal.html:38 |
|
194 | 196 | msgid "Post" |
|
195 | 197 | msgstr "Отправить" |
|
196 | 198 | |
|
197 | 199 | #: templates/boards/all_threads.html:136 |
|
198 | 200 | msgid "Tags must be delimited by spaces. Text or image is required." |
|
199 | 201 | msgstr "" |
|
200 | 202 | "Метки должны быть разделены пробелами. Текст или изображение обязательны." |
|
201 | 203 | |
|
202 | 204 | #: templates/boards/all_threads.html:138 templates/boards/preview.html:6 |
|
203 | 205 | #: templates/boards/staticpages/help.html:21 |
|
204 | 206 | #: templates/boards/thread_normal.html:42 |
|
205 | 207 | msgid "Preview" |
|
206 | 208 | msgstr "Предпросмотр" |
|
207 | 209 | |
|
208 | 210 | #: templates/boards/all_threads.html:140 templates/boards/thread_normal.html:45 |
|
209 | 211 | msgid "Text syntax" |
|
210 | 212 | msgstr "Синтаксис текста" |
|
211 | 213 | |
|
212 | 214 | #: templates/boards/all_threads.html:154 templates/boards/feed.html:53 |
|
213 | 215 | msgid "Pages:" |
|
214 | 216 | msgstr "Страницы: " |
|
215 | 217 | |
|
216 | 218 | #: templates/boards/authors.html:6 templates/boards/authors.html.py:12 |
|
217 | 219 | msgid "Authors" |
|
218 | 220 | msgstr "Авторы" |
|
219 | 221 | |
|
220 | 222 | #: templates/boards/authors.html:26 |
|
221 | 223 | msgid "Distributed under the" |
|
222 | 224 | msgstr "Распространяется под" |
|
223 | 225 | |
|
224 | 226 | #: templates/boards/authors.html:28 |
|
225 | 227 | msgid "license" |
|
226 | 228 | msgstr "лицензией" |
|
227 | 229 | |
|
228 | 230 | #: templates/boards/authors.html:30 |
|
229 | 231 | msgid "Repository" |
|
230 | 232 | msgstr "Репозиторий" |
|
231 | 233 | |
|
232 | 234 | #: templates/boards/base.html:14 templates/boards/base.html.py:41 |
|
233 | 235 | msgid "Feed" |
|
234 | 236 | msgstr "Лента" |
|
235 | 237 | |
|
236 | 238 | #: templates/boards/base.html:31 |
|
237 | 239 | msgid "All threads" |
|
238 | 240 | msgstr "Все темы" |
|
239 | 241 | |
|
240 | 242 | #: templates/boards/base.html:37 |
|
241 | 243 | msgid "Add tags" |
|
242 | 244 | msgstr "Добавить метки" |
|
243 | 245 | |
|
244 | 246 | #: templates/boards/base.html:39 |
|
245 | 247 | msgid "Tag management" |
|
246 | 248 | msgstr "Управление метками" |
|
247 | 249 | |
|
248 | 250 | #: templates/boards/base.html:39 |
|
249 | 251 | msgid "tags" |
|
250 | 252 | msgstr "метки" |
|
251 | 253 | |
|
252 | 254 | #: templates/boards/base.html:40 |
|
253 | 255 | msgid "search" |
|
254 | 256 | msgstr "поиск" |
|
255 | 257 | |
|
256 | 258 | #: templates/boards/base.html:41 templates/boards/feed.html:11 |
|
257 | 259 | msgid "feed" |
|
258 | 260 | msgstr "лента" |
|
259 | 261 | |
|
260 | 262 | #: templates/boards/base.html:42 templates/boards/random.html:6 |
|
261 | 263 | msgid "Random images" |
|
262 | 264 | msgstr "Случайные изображения" |
|
263 | 265 | |
|
264 | 266 | #: templates/boards/base.html:42 |
|
265 | 267 | msgid "random" |
|
266 | 268 | msgstr "случайные" |
|
267 | 269 | |
|
268 | 270 | #: templates/boards/base.html:45 templates/boards/base.html.py:46 |
|
269 | 271 | #: templates/boards/notifications.html:8 |
|
270 | 272 | msgid "Notifications" |
|
271 | 273 | msgstr "Уведомления" |
|
272 | 274 | |
|
273 | 275 | #: templates/boards/base.html:53 templates/boards/settings.html:8 |
|
274 | 276 | msgid "Settings" |
|
275 | 277 | msgstr "Настройки" |
|
276 | 278 | |
|
277 | 279 | #: templates/boards/base.html:66 |
|
278 | 280 | msgid "Admin" |
|
279 | 281 | msgstr "Администрирование" |
|
280 | 282 | |
|
281 | 283 | #: templates/boards/base.html:68 |
|
282 | 284 | #, python-format |
|
283 | 285 | msgid "Speed: %(ppd)s posts per day" |
|
284 | 286 | msgstr "Скорость: %(ppd)s сообщений в день" |
|
285 | 287 | |
|
286 | 288 | #: templates/boards/base.html:70 |
|
287 | 289 | msgid "Up" |
|
288 | 290 | msgstr "Вверх" |
|
289 | 291 | |
|
290 | 292 | #: templates/boards/feed.html:45 |
|
291 | 293 | msgid "No posts exist. Create the first one!" |
|
292 | 294 | msgstr "Нет сообщений. Создайте первое!" |
|
293 | 295 | |
|
294 | 296 | #: templates/boards/post.html:25 |
|
295 | 297 | msgid "Open" |
|
296 | 298 | msgstr "Открыть" |
|
297 | 299 | |
|
298 | 300 | #: templates/boards/post.html:27 templates/boards/post.html.py:38 |
|
299 | 301 | msgid "Reply" |
|
300 | 302 | msgstr "Ответить" |
|
301 | 303 | |
|
302 | 304 | #: templates/boards/post.html:33 |
|
303 | 305 | msgid " in " |
|
304 | 306 | msgstr " в " |
|
305 | 307 | |
|
306 | 308 | #: templates/boards/post.html:43 |
|
307 | 309 | msgid "Edit" |
|
308 | 310 | msgstr "Изменить" |
|
309 | 311 | |
|
310 | 312 | #: templates/boards/post.html:45 |
|
311 | 313 | msgid "Edit thread" |
|
312 | 314 | msgstr "Изменить тему" |
|
313 | 315 | |
|
314 | 316 | #: templates/boards/post.html:84 |
|
315 | 317 | msgid "Replies" |
|
316 | 318 | msgstr "Ответы" |
|
317 | 319 | |
|
318 | 320 | #: templates/boards/post.html:97 templates/boards/thread.html:34 |
|
319 | 321 | msgid "messages" |
|
320 | 322 | msgstr "сообщений" |
|
321 | 323 | |
|
322 | 324 | #: templates/boards/post.html:98 templates/boards/thread.html:35 |
|
323 | 325 | msgid "images" |
|
324 | 326 | msgstr "изображений" |
|
325 | 327 | |
|
326 | 328 | #: templates/boards/rss/post.html:5 |
|
327 | 329 | msgid "Post image" |
|
328 | 330 | msgstr "Изображение сообщения" |
|
329 | 331 | |
|
330 | 332 | #: templates/boards/settings.html:16 |
|
331 | 333 | msgid "You are moderator." |
|
332 | 334 | msgstr "Вы модератор." |
|
333 | 335 | |
|
334 | 336 | #: templates/boards/settings.html:20 |
|
335 | 337 | msgid "Hidden tags:" |
|
336 | 338 | msgstr "Скрытые метки:" |
|
337 | 339 | |
|
338 | 340 | #: templates/boards/settings.html:28 |
|
339 | 341 | msgid "No hidden tags." |
|
340 | 342 | msgstr "Нет скрытых меток." |
|
341 | 343 | |
|
342 | 344 | #: templates/boards/settings.html:37 |
|
343 | 345 | msgid "Save" |
|
344 | 346 | msgstr "Сохранить" |
|
345 | 347 | |
|
346 | 348 | #: templates/boards/staticpages/banned.html:6 |
|
347 | 349 | msgid "Banned" |
|
348 | 350 | msgstr "Заблокирован" |
|
349 | 351 | |
|
350 | 352 | #: templates/boards/staticpages/banned.html:11 |
|
351 | 353 | msgid "Your IP address has been banned. Contact the administrator" |
|
352 | 354 | msgstr "Ваш IP адрес был заблокирован. Свяжитесь с администратором" |
|
353 | 355 | |
|
354 | 356 | #: templates/boards/staticpages/help.html:6 |
|
355 | 357 | #: templates/boards/staticpages/help.html:10 |
|
356 | 358 | msgid "Syntax" |
|
357 | 359 | msgstr "Синтаксис" |
|
358 | 360 | |
|
359 | 361 | #: templates/boards/staticpages/help.html:11 |
|
360 | 362 | msgid "Italic text" |
|
361 | 363 | msgstr "Курсивный текст" |
|
362 | 364 | |
|
363 | 365 | #: templates/boards/staticpages/help.html:12 |
|
364 | 366 | msgid "Bold text" |
|
365 | 367 | msgstr "Полужирный текст" |
|
366 | 368 | |
|
367 | 369 | #: templates/boards/staticpages/help.html:13 |
|
368 | 370 | msgid "Spoiler" |
|
369 | 371 | msgstr "Спойлер" |
|
370 | 372 | |
|
371 | 373 | #: templates/boards/staticpages/help.html:14 |
|
372 | 374 | msgid "Link to a post" |
|
373 | 375 | msgstr "Ссылка на сообщение" |
|
374 | 376 | |
|
375 | 377 | #: templates/boards/staticpages/help.html:15 |
|
376 | 378 | msgid "Strikethrough text" |
|
377 | 379 | msgstr "Зачеркнутый текст" |
|
378 | 380 | |
|
379 | 381 | #: templates/boards/staticpages/help.html:16 |
|
380 | 382 | msgid "Comment" |
|
381 | 383 | msgstr "Комментарий" |
|
382 | 384 | |
|
383 | 385 | #: templates/boards/staticpages/help.html:17 |
|
384 | 386 | #: templates/boards/staticpages/help.html:18 |
|
385 | 387 | msgid "Quote" |
|
386 | 388 | msgstr "Цитата" |
|
387 | 389 | |
|
388 | 390 | #: templates/boards/staticpages/help.html:21 |
|
389 | 391 | msgid "You can try pasting the text and previewing the result here:" |
|
390 | 392 | msgstr "Вы можете попробовать вставить текст и проверить результат здесь:" |
|
391 | 393 | |
|
392 | 394 | #: templates/boards/tags.html:14 |
|
393 | 395 | msgid "Sections:" |
|
394 | 396 | msgstr "Разделы:" |
|
395 | 397 | |
|
396 | 398 | #: templates/boards/tags.html:26 |
|
397 | 399 | msgid "Other tags:" |
|
398 | 400 | msgstr "Другие метки:" |
|
399 | 401 | |
|
400 | 402 | #: templates/boards/tags.html:38 |
|
401 | 403 | msgid "All tags..." |
|
402 | 404 | msgstr "Все метки..." |
|
403 | 405 | |
|
404 | 406 | #: templates/boards/thread.html:15 |
|
405 | 407 | msgid "Normal" |
|
406 | 408 | msgstr "Нормальный" |
|
407 | 409 | |
|
408 | 410 | #: templates/boards/thread.html:16 |
|
409 | 411 | msgid "Gallery" |
|
410 | 412 | msgstr "Галерея" |
|
411 | 413 | |
|
412 | 414 | #: templates/boards/thread.html:17 |
|
413 | 415 | msgid "Tree" |
|
414 | 416 | msgstr "Дерево" |
|
415 | 417 | |
|
416 | 418 | #: templates/boards/thread.html:36 |
|
417 | 419 | msgid "Last update: " |
|
418 | 420 | msgstr "Последнее обновление: " |
|
419 | 421 | |
|
420 | 422 | #: templates/boards/thread_gallery.html:36 |
|
421 | 423 | msgid "No images." |
|
422 | 424 | msgstr "Нет изображений." |
|
423 | 425 | |
|
424 | 426 | #: templates/boards/thread_normal.html:17 |
|
425 | 427 | msgid "posts to bumplimit" |
|
426 | 428 | msgstr "сообщений до бамплимита" |
|
427 | 429 | |
|
428 | 430 | #: templates/boards/thread_normal.html:31 |
|
429 | 431 | msgid "Reply to thread" |
|
430 | 432 | msgstr "Ответить в тему" |
|
431 | 433 | |
|
432 | 434 | #: templates/boards/thread_normal.html:46 |
|
433 | 435 | msgid "Close form" |
|
434 | 436 | msgstr "Закрыть форму" |
|
435 | 437 | |
|
436 | 438 | #: templates/search/search.html:17 |
|
437 | 439 | msgid "Ok" |
|
438 | 440 | msgstr "Ок" |
@@ -1,86 +1,92 b'' | |||
|
1 | 1 | from django.template.loader import render_to_string |
|
2 | 2 | from django.db import models |
|
3 | 3 | from django.db.models import Count |
|
4 | 4 | from django.core.urlresolvers import reverse |
|
5 | 5 | |
|
6 | 6 | from boards.models.base import Viewable |
|
7 | 7 | from boards.utils import cached_result |
|
8 | 8 | |
|
9 | 9 | |
|
10 | 10 | __author__ = 'neko259' |
|
11 | 11 | |
|
12 | 12 | |
|
13 | 13 | class TagManager(models.Manager): |
|
14 | 14 | |
|
15 | 15 | def get_not_empty_tags(self): |
|
16 | 16 | """ |
|
17 | 17 | Gets tags that have non-archived threads. |
|
18 | 18 | """ |
|
19 | 19 | |
|
20 | 20 | return self.annotate(num_threads=Count('thread')).filter(num_threads__gt=0)\ |
|
21 | 21 | .order_by('-required', 'name') |
|
22 | 22 | |
|
23 | 23 | def get_tag_url_list(self, tags: list) -> str: |
|
24 | 24 | """ |
|
25 | 25 | Gets a comma-separated list of tag links. |
|
26 | 26 | """ |
|
27 | 27 | |
|
28 | 28 | return ', '.join([tag.get_view() for tag in tags]) |
|
29 | 29 | |
|
30 | 30 | |
|
31 | 31 | class Tag(models.Model, Viewable): |
|
32 | 32 | """ |
|
33 | 33 | A tag is a text node assigned to the thread. The tag serves as a board |
|
34 | 34 | section. There can be multiple tags for each thread |
|
35 | 35 | """ |
|
36 | 36 | |
|
37 | 37 | objects = TagManager() |
|
38 | 38 | |
|
39 | 39 | class Meta: |
|
40 | 40 | app_label = 'boards' |
|
41 | 41 | ordering = ('name',) |
|
42 | 42 | |
|
43 | 43 | name = models.CharField(max_length=100, db_index=True, unique=True) |
|
44 | 44 | required = models.BooleanField(default=False, db_index=True) |
|
45 | 45 | description = models.TextField(blank=True) |
|
46 | 46 | |
|
47 | 47 | def __str__(self): |
|
48 | 48 | return self.name |
|
49 | 49 | |
|
50 | 50 | def is_empty(self) -> bool: |
|
51 | 51 | """ |
|
52 | 52 | Checks if the tag has some threads. |
|
53 | 53 | """ |
|
54 | 54 | |
|
55 | 55 | return self.get_thread_count() == 0 |
|
56 | 56 | |
|
57 | def get_thread_count(self) -> int: | |
|
58 |
|
|
|
57 | def get_thread_count(self, archived=None) -> int: | |
|
58 | threads = self.get_threads() | |
|
59 | if archived is not None: | |
|
60 | threads = threads.filter(archived=archived) | |
|
61 | return threads.count() | |
|
62 | ||
|
63 | def get_active_thread_count(self) -> int: | |
|
64 | return self.get_thread_count(archived=False) | |
|
59 | 65 | |
|
60 | 66 | def get_absolute_url(self): |
|
61 | 67 | return reverse('tag', kwargs={'tag_name': self.name}) |
|
62 | 68 | |
|
63 | 69 | def get_threads(self): |
|
64 | 70 | return self.thread_set.order_by('-bump_time') |
|
65 | 71 | |
|
66 | 72 | def is_required(self): |
|
67 | 73 | return self.required |
|
68 | 74 | |
|
69 | 75 | def get_view(self): |
|
70 | 76 | link = '<a class="tag" href="{}">{}</a>'.format( |
|
71 | 77 | self.get_absolute_url(), self.name) |
|
72 | 78 | if self.is_required(): |
|
73 | 79 | link = '<b>{}</b>'.format(link) |
|
74 | 80 | return link |
|
75 | 81 | |
|
76 | 82 | def get_search_view(self, *args, **kwargs): |
|
77 | 83 | return render_to_string('boards/tag.html', { |
|
78 | 84 | 'tag': self, |
|
79 | 85 | }) |
|
80 | 86 | |
|
81 | 87 | @cached_result() |
|
82 | 88 | def get_post_count(self): |
|
83 | 89 | return self.get_threads().aggregate(num_posts=Count('post'))['num_posts'] |
|
84 | 90 | |
|
85 | 91 | def get_description(self): |
|
86 | 92 | return self.description |
@@ -1,179 +1,179 b'' | |||
|
1 | 1 | {% extends "boards/base.html" %} |
|
2 | 2 | |
|
3 | 3 | {% load i18n %} |
|
4 | 4 | {% load board %} |
|
5 | 5 | {% load static %} |
|
6 | 6 | {% load tz %} |
|
7 | 7 | |
|
8 | 8 | {% block head %} |
|
9 | 9 | <meta name="robots" content="noindex"> |
|
10 | 10 | |
|
11 | 11 | {% if tag %} |
|
12 | 12 | <title>{{ tag.name }} - {{ site_name }}</title> |
|
13 | 13 | {% else %} |
|
14 | 14 | <title>{{ site_name }}</title> |
|
15 | 15 | {% endif %} |
|
16 | 16 | |
|
17 | 17 | {% if prev_page_link %} |
|
18 | 18 | <link rel="prev" href="{{ prev_page_link }}" /> |
|
19 | 19 | {% endif %} |
|
20 | 20 | {% if next_page_link %} |
|
21 | 21 | <link rel="next" href="{{ next_page_link }}" /> |
|
22 | 22 | {% endif %} |
|
23 | 23 | |
|
24 | 24 | {% endblock %} |
|
25 | 25 | |
|
26 | 26 | {% block content %} |
|
27 | 27 | |
|
28 | 28 | {% get_current_language as LANGUAGE_CODE %} |
|
29 | 29 | {% get_current_timezone as TIME_ZONE %} |
|
30 | 30 | |
|
31 | 31 | {% for banner in banners %} |
|
32 | 32 | <div class="post"> |
|
33 | 33 | <div class="title">{{ banner.title }}</div> |
|
34 | 34 | <div>{{ banner.text }}</div> |
|
35 | 35 | <div>{% trans 'Related message' %}: <a href="{{ banner.post.get_absolute_url }}">>>{{ banner.post.id }}</a></div> |
|
36 | 36 | </div> |
|
37 | 37 | {% endfor %} |
|
38 | 38 | |
|
39 | 39 | {% if tag %} |
|
40 | 40 | <div class="tag_info"> |
|
41 | 41 | <div> |
|
42 | 42 | {% for image in random_images %} |
|
43 | 43 | <a href="{{ image.get_random_associated_post.get_absolute_url }}"><img |
|
44 | 44 | src="{{ image.image.url_200x150 }}" |
|
45 | 45 | width="{{ image.pre_width }}" |
|
46 | 46 | height="{{ image.pre_height }}"/></a> |
|
47 | 47 | {% endfor %} |
|
48 | 48 | </div> |
|
49 | 49 | <h2> |
|
50 | 50 | <form action="{% url 'tag' tag.name %}" method="post" class="post-button-form"> |
|
51 | 51 | {% if is_favorite %} |
|
52 | 52 | <button name="method" value="unsubscribe" class="fav">★</button> |
|
53 | 53 | {% else %} |
|
54 | 54 | <button name="method" value="subscribe" class="not_fav">★</button> |
|
55 | 55 | {% endif %} |
|
56 | 56 | </form> |
|
57 | 57 | <form action="{% url 'tag' tag.name %}" method="post" class="post-button-form"> |
|
58 | 58 | {% if is_hidden %} |
|
59 | 59 | <button name="method" value="unhide" class="fav">H</button> |
|
60 | 60 | {% else %} |
|
61 | 61 | <button name="method" value="hide" class="not_fav">H</button> |
|
62 | 62 | {% endif %} |
|
63 | 63 | </form> |
|
64 | 64 | {% autoescape off %} |
|
65 | 65 | {{ tag.get_view }} |
|
66 | 66 | {% endautoescape %} |
|
67 | 67 | {% if moderator %} |
|
68 | 68 | <span class="moderator_info">[<a href="{% url 'admin:boards_tag_change' tag.id %}">{% trans 'Edit tag' %}</a>]</span> |
|
69 | 69 | {% endif %} |
|
70 | 70 | </h2> |
|
71 | 71 | {% if tag.get_description %} |
|
72 | 72 | {% autoescape off %} |
|
73 | 73 | <p>{{ tag.get_description }}</p> |
|
74 | 74 | {% endautoescape %} |
|
75 | 75 | {% endif %} |
|
76 | <p>{% blocktrans with thread_count=tag.get_thread_count post_count=tag.get_post_count %}This tag has {{ thread_count }} threads and {{ post_count }} posts.{% endblocktrans %}</p> | |
|
76 | <p>{% blocktrans with active_thread_count=tag.get_active_thread_count thread_count=tag.get_thread_count post_count=tag.get_post_count %}This tag has {{ active_thread_count}}/{{ thread_count }} threads and {{ post_count }} posts.{% endblocktrans %}</p> | |
|
77 | 77 | </div> |
|
78 | 78 | {% endif %} |
|
79 | 79 | |
|
80 | 80 | {% if threads %} |
|
81 | 81 | {% if prev_page_link %} |
|
82 | 82 | <div class="page_link"> |
|
83 | 83 | <a href="{{ prev_page_link }}">{% trans "Previous page" %}</a> |
|
84 | 84 | </div> |
|
85 | 85 | {% endif %} |
|
86 | 86 | |
|
87 | 87 | {% for thread in threads %} |
|
88 | 88 | <div class="thread"> |
|
89 | 89 | {% post_view thread.get_opening_post moderator=moderator is_opening=True thread=thread truncated=True need_open_link=True %} |
|
90 | 90 | {% if not thread.archived %} |
|
91 | 91 | {% with last_replies=thread.get_last_replies %} |
|
92 | 92 | {% if last_replies %} |
|
93 | 93 | {% with skipped_replies_count=thread.get_skipped_replies_count %} |
|
94 | 94 | {% if skipped_replies_count %} |
|
95 | 95 | <div class="skipped_replies"> |
|
96 | 96 | <a href="{% url 'thread' thread.get_opening_post_id %}"> |
|
97 | 97 | {% blocktrans with count=skipped_replies_count %}Skipped {{ count }} replies. Open thread to see all replies.{% endblocktrans %} |
|
98 | 98 | </a> |
|
99 | 99 | </div> |
|
100 | 100 | {% endif %} |
|
101 | 101 | {% endwith %} |
|
102 | 102 | <div class="last-replies"> |
|
103 | 103 | {% for post in last_replies %} |
|
104 | 104 | {% post_view post is_opening=False moderator=moderator truncated=True %} |
|
105 | 105 | {% endfor %} |
|
106 | 106 | </div> |
|
107 | 107 | {% endif %} |
|
108 | 108 | {% endwith %} |
|
109 | 109 | {% endif %} |
|
110 | 110 | </div> |
|
111 | 111 | {% endfor %} |
|
112 | 112 | |
|
113 | 113 | {% if next_page_link %} |
|
114 | 114 | <div class="page_link"> |
|
115 | 115 | <a href="{{ next_page_link }}">{% trans "Next page" %}</a> |
|
116 | 116 | </div> |
|
117 | 117 | {% endif %} |
|
118 | 118 | {% else %} |
|
119 | 119 | <div class="post"> |
|
120 | 120 | {% trans 'No threads exist. Create the first one!' %}</div> |
|
121 | 121 | {% endif %} |
|
122 | 122 | |
|
123 | 123 | <div class="post-form-w"> |
|
124 | 124 | <script src="{% static 'js/panel.js' %}"></script> |
|
125 | 125 | <div class="post-form"> |
|
126 | 126 | <div class="form-title">{% trans "Create new thread" %}</div> |
|
127 | 127 | <div class="swappable-form-full"> |
|
128 | 128 | <form enctype="multipart/form-data" method="post" id="form">{% csrf_token %} |
|
129 | 129 | {{ form.as_div }} |
|
130 | 130 | <div class="form-submit"> |
|
131 | 131 | <input type="submit" value="{% trans "Post" %}"/> |
|
132 | 132 | </div> |
|
133 | 133 | </form> |
|
134 | 134 | </div> |
|
135 | 135 | <div> |
|
136 | 136 | {% trans 'Tags must be delimited by spaces. Text or image is required.' %} |
|
137 | 137 | </div> |
|
138 | 138 | <div><button id="preview-button">{% trans 'Preview' %}</button></div> |
|
139 | 139 | <div id="preview-text"></div> |
|
140 | 140 | <div><a href="{% url "staticpage" name="help" %}">{% trans 'Text syntax' %}</a></div> |
|
141 | 141 | <div><a href="{% url "tags" "required" %}">{% trans 'Tags' %}</a></div> |
|
142 | 142 | </div> |
|
143 | 143 | </div> |
|
144 | 144 | |
|
145 | 145 | <script src="{% static 'js/form.js' %}"></script> |
|
146 | 146 | <script src="{% static 'js/thread_create.js' %}"></script> |
|
147 | 147 | |
|
148 | 148 | {% endblock %} |
|
149 | 149 | |
|
150 | 150 | {% block metapanel %} |
|
151 | 151 | |
|
152 | 152 | <span class="metapanel"> |
|
153 | 153 | <b><a href="{% url "authors" %}">{{ site_name }}</a> {{ version }}</b> |
|
154 | 154 | {% trans "Pages:" %} |
|
155 | 155 | [ |
|
156 | 156 | {% with dividers=paginator.get_dividers %} |
|
157 | 157 | {% for page in paginator.get_divided_range %} |
|
158 | 158 | {% if page in dividers %} |
|
159 | 159 | …, |
|
160 | 160 | {% endif %} |
|
161 | 161 | <a |
|
162 | 162 | {% ifequal page current_page.number %} |
|
163 | 163 | class="current_page" |
|
164 | 164 | {% endifequal %} |
|
165 | 165 | href=" |
|
166 | 166 | {% if tag %} |
|
167 | 167 | {% url "tag" tag_name=tag.name %}?page={{ page }} |
|
168 | 168 | {% else %} |
|
169 | 169 | {% url "index" %}?page={{ page }} |
|
170 | 170 | {% endif %} |
|
171 | 171 | ">{{ page }}</a> |
|
172 | 172 | {% if not forloop.last %},{% endif %} |
|
173 | 173 | {% endfor %} |
|
174 | 174 | {% endwith %} |
|
175 | 175 | ] |
|
176 | 176 | [<a href="rss/">RSS</a>] |
|
177 | 177 | </span> |
|
178 | 178 | |
|
179 | 179 | {% endblock %} |
General Comments 0
You need to be logged in to leave comments.
Login now