##// END OF EJS Templates
Show related tags in the tag page
neko259 -
r1269:819f972f default
parent child Browse files
Show More
1 NO CONTENT: modified file, binary diff hidden
@@ -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: 2015-08-10 10:22+0300\n"
10 "POT-Creation-Date: 2015-08-12 18:32+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"
@@ -111,7 +111,7 b' msgstr "\xd0\xa2\xd0\xb5\xd0\xba\xd1\x81\xd1\x82 \xd0\xb8\xd0\xbb\xd0\xb8 \xd0\xba\xd0\xb0\xd1\x80\xd1\x82\xd0\xb8\xd0\xbd\xd0\xba\xd0\xb0 \xd0\xb4\xd0\xbe\xd0\xbb\xd0\xb6\xd0\xbd\xd1\x8b \xd0\xb1\xd1\x8b\xd1\x82\xd1\x8c \xd0\xb2\xd0\xb2\xd0\xb5\xd0\xb4\xd0\xb5\xd0\xbd\xd1\x8b."'
111 111 msgid "Image must be less than %s bytes"
112 112 msgstr "Изображение должно быть менее %s байт"
113 113
114 #: forms.py:338 templates/boards/all_threads.html:141
114 #: forms.py:338 templates/boards/all_threads.html:154
115 115 #: templates/boards/rss/post.html:10 templates/boards/tags.html:6
116 116 msgid "Tags"
117 117 msgstr "Метки"
@@ -156,62 +156,68 b' msgstr "\xd0\xad\xd1\x82\xd0\xbe\xd0\xb9 \xd1\x81\xd1\x82\xd1\x80\xd0\xb0\xd0\xbd\xd0\xb8\xd1\x86\xd1\x8b \xd0\xbd\xd0\xb5 \xd1\x81\xd1\x83\xd1\x89\xd0\xb5\xd1\x81\xd1\x82\xd0\xb2\xd1\x83\xd0\xb5\xd1\x82"'
156 156 msgid "Related message"
157 157 msgstr "Связанное сообщение"
158 158
159 #: templates/boards/all_threads.html:68
159 #: templates/boards/all_threads.html:71
160 160 msgid "Edit tag"
161 161 msgstr "Изменить метку"
162 162
163 #: templates/boards/all_threads.html:76
163 #: templates/boards/all_threads.html:79
164 164 #, python-format
165 #| msgid "This tag has %(thread_count)s threads and %(post_count)s posts."
166 165 msgid ""
167 166 "This tag has %(active_thread_count)s/%(thread_count)s threads and "
168 167 "%(post_count)s posts."
169 msgstr "С этой меткой есть %(active_thread_count)s/%(thread_count)s тем и %(post_count)s сообщений."
168 msgstr ""
169 "С этой меткой есть %(active_thread_count)s/%(thread_count)s тем и "
170 "%(post_count)s сообщений."
170 171
171 #: templates/boards/all_threads.html:83 templates/boards/feed.html:30
172 #: templates/boards/all_threads.html:81
173 #| msgid "Related message"
174 msgid "Related tags:"
175 msgstr "Похожие метки:"
176
177 #: templates/boards/all_threads.html:96 templates/boards/feed.html:30
172 178 #: templates/boards/notifications.html:17 templates/search/search.html:26
173 179 msgid "Previous page"
174 180 msgstr "Предыдущая страница"
175 181
176 #: templates/boards/all_threads.html:97
182 #: templates/boards/all_threads.html:110
177 183 #, python-format
178 184 msgid "Skipped %(count)s replies. Open thread to see all replies."
179 185 msgstr "Пропущено %(count)s ответов. Откройте тред, чтобы увидеть все ответы."
180 186
181 #: templates/boards/all_threads.html:115 templates/boards/feed.html:40
187 #: templates/boards/all_threads.html:128 templates/boards/feed.html:40
182 188 #: templates/boards/notifications.html:27 templates/search/search.html:37
183 189 msgid "Next page"
184 190 msgstr "Следующая страница"
185 191
186 #: templates/boards/all_threads.html:120
192 #: templates/boards/all_threads.html:133
187 193 msgid "No threads exist. Create the first one!"
188 194 msgstr "Нет тем. Создайте первую!"
189 195
190 #: templates/boards/all_threads.html:126
196 #: templates/boards/all_threads.html:139
191 197 msgid "Create new thread"
192 198 msgstr "Создать новую тему"
193 199
194 #: templates/boards/all_threads.html:131 templates/boards/preview.html:16
200 #: templates/boards/all_threads.html:144 templates/boards/preview.html:16
195 201 #: templates/boards/thread_normal.html:38
196 202 msgid "Post"
197 203 msgstr "Отправить"
198 204
199 #: templates/boards/all_threads.html:136
205 #: templates/boards/all_threads.html:149
200 206 msgid "Tags must be delimited by spaces. Text or image is required."
201 207 msgstr ""
202 208 "Метки должны быть разделены пробелами. Текст или изображение обязательны."
203 209
204 #: templates/boards/all_threads.html:138 templates/boards/preview.html:6
210 #: templates/boards/all_threads.html:151 templates/boards/preview.html:6
205 211 #: templates/boards/staticpages/help.html:21
206 212 #: templates/boards/thread_normal.html:42
207 213 msgid "Preview"
208 214 msgstr "Предпросмотр"
209 215
210 #: templates/boards/all_threads.html:140 templates/boards/thread_normal.html:45
216 #: templates/boards/all_threads.html:153 templates/boards/thread_normal.html:45
211 217 msgid "Text syntax"
212 218 msgstr "Синтаксис текста"
213 219
214 #: templates/boards/all_threads.html:154 templates/boards/feed.html:53
220 #: templates/boards/all_threads.html:167 templates/boards/feed.html:53
215 221 msgid "Pages:"
216 222 msgstr "Страницы: "
217 223
@@ -391,15 +397,15 b' msgstr "\xd0\xa6\xd0\xb8\xd1\x82\xd0\xb0\xd1\x82\xd0\xb0"'
391 397 msgid "You can try pasting the text and previewing the result here:"
392 398 msgstr "Вы можете попробовать вставить текст и проверить результат здесь:"
393 399
394 #: templates/boards/tags.html:14
400 #: templates/boards/tags.html:17
395 401 msgid "Sections:"
396 402 msgstr "Разделы:"
397 403
398 #: templates/boards/tags.html:26
404 #: templates/boards/tags.html:30
399 405 msgid "Other tags:"
400 406 msgstr "Другие метки:"
401 407
402 #: templates/boards/tags.html:38
408 #: templates/boards/tags.html:43
403 409 msgid "All tags..."
404 410 msgstr "Все метки..."
405 411
@@ -17,7 +17,7 b' class TagManager(models.Manager):'
17 17 Gets tags that have non-archived threads.
18 18 """
19 19
20 return self.annotate(num_threads=Count('thread')).filter(num_threads__gt=0)\
20 return self.annotate(num_threads=Count('thread_tags')).filter(num_threads__gt=0)\
21 21 .order_by('-required', 'name')
22 22
23 23 def get_tag_url_list(self, tags: list) -> str:
@@ -67,7 +67,7 b' class Tag(models.Model, Viewable):'
67 67 return reverse('tag', kwargs={'tag_name': self.name})
68 68
69 69 def get_threads(self):
70 return self.thread_set.order_by('-bump_time')
70 return self.thread_tags.order_by('-bump_time')
71 71
72 72 def is_required(self):
73 73 return self.required
@@ -100,3 +100,7 b' class Tag(models.Model, Viewable):'
100 100
101 101 def get_first_letter(self):
102 102 return self.name and self.name[0] or ''
103
104 def get_related_tags(self):
105 return Tag.objects.filter(thread_tags__in=self.get_threads()).exclude(
106 id=self.id).distinct()
@@ -65,7 +65,7 b' class Thread(models.Model):'
65 65 class Meta:
66 66 app_label = 'boards'
67 67
68 tags = models.ManyToManyField('Tag')
68 tags = models.ManyToManyField('Tag', related_name='thread_tags')
69 69 bump_time = models.DateTimeField(db_index=True)
70 70 last_edit_time = models.DateTimeField()
71 71 archived = models.BooleanField(default=False)
@@ -77,6 +77,15 b''
77 77 {% endautoescape %}
78 78 {% endif %}
79 79 <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>
80 {% if related_tags %}
81 <p>{% trans 'Related tags:' %}
82 {% for rel_tag in related_tags %}
83 {% autoescape off %}
84 {{ rel_tag.get_view }}{% if not forloop.last %}, {% endif %}
85 {% endautoescape %}
86 {% endfor %}
87 </p>
88 {% endif %}
80 89 </div>
81 90 </div>
82 91 {% endif %}
@@ -13,6 +13,8 b" PARAM_TAG = 'tag'"
13 13 PARAM_IS_FAVORITE = 'is_favorite'
14 14 PARAM_IS_HIDDEN = 'is_hidden'
15 15 PARAM_RANDOM_IMAGE_POST = 'random_image_post'
16 PARAM_RELATED_TAGS = 'related_tags'
17
16 18
17 19 __author__ = 'neko259'
18 20
@@ -49,6 +51,7 b' class TagView(AllThreadsView, Dispatcher'
49 51 params[PARAM_IS_HIDDEN] = hidden_tag_names is not None and tag.name in hidden_tag_names
50 52
51 53 params[PARAM_RANDOM_IMAGE_POST] = tag.get_random_image_post()
54 params[PARAM_RELATED_TAGS] = tag.get_related_tags().all()
52 55
53 56 return params
54 57
General Comments 0
You need to be logged in to leave comments. Login now