##// END OF EJS Templates
Post model code refacoring. Added help on the "thread" parser tag
neko259 -
r1063:fbac3cd5 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-03-26 20:40+0200\n"
10 "POT-Creation-Date: 2015-03-29 16:19+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"
@@ -265,7 +265,7 b' msgstr "\xd0\xa1\xd0\xb8\xd0\xbd\xd1\x82\xd0\xb0\xd0\xba\xd1\x81\xd0\xb8\xd1\x81 \xd1\x82\xd0\xb5\xd0\xba\xd1\x81\xd1\x82\xd0\xb0"'
265 265 msgid "Pages:"
266 266 msgstr "Страницы: "
267 267
268 #: templates/boards/preview.html:6 templates/boards/staticpages/help.html:19
268 #: templates/boards/preview.html:6 templates/boards/staticpages/help.html:20
269 269 msgid "Preview"
270 270 msgstr "Предпросмотр"
271 271
@@ -319,18 +319,22 b' msgid "Link to a post"'
319 319 msgstr "Ссылка на сообщение"
320 320
321 321 #: templates/boards/staticpages/help.html:15
322 msgid "Add post to this thread"
323 msgstr "Добавить сообщение в эту тему"
324
325 #: templates/boards/staticpages/help.html:16
322 326 msgid "Strikethrough text"
323 327 msgstr "Зачеркнутый текст"
324 328
325 #: templates/boards/staticpages/help.html:16
329 #: templates/boards/staticpages/help.html:17
326 330 msgid "Comment"
327 331 msgstr "Комментарий"
328 332
329 #: templates/boards/staticpages/help.html:17
333 #: templates/boards/staticpages/help.html:18
330 334 msgid "Quote"
331 335 msgstr "Цитата"
332 336
333 #: templates/boards/staticpages/help.html:19
337 #: templates/boards/staticpages/help.html:20
334 338 msgid "You can try pasting the text and previewing the result here:"
335 339 msgstr "Вы можете попробовать вставить текст и проверить результат здесь:"
336 340
@@ -87,7 +87,7 b' class PostManager(models.Manager):'
87 87 posting_time = timezone.now()
88 88 if not thread:
89 89 thread = boards.models.thread.Thread.objects.create(
90 bump_time=posting_time, last_edit_time=posting_time)
90 bump_time=posting_time, last_edit_time=posting_time)
91 91 new_thread = True
92 92 else:
93 93 new_thread = False
@@ -223,10 +223,9 b' class Post(models.Model, Viewable):'
223 223 Builds a replies map string from replies list. This is a cache to stop
224 224 the server from recalculating the map on every post show.
225 225 """
226 map_string = ''
227 226
228 227 post_urls = ['<a href="{}">&gt;&gt;{}</a>'.format(
229 refpost.get_url(), refpost.id) for refpost in self.referenced_posts.all()]
228 refpost.get_url(), refpost.id) for refpost in self.referenced_posts.all()]
230 229
231 230 self.refmap = ', '.join(post_urls)
232 231
@@ -243,18 +242,6 b' class Post(models.Model, Viewable):'
243 242
244 243 return self.get_thread().get_opening_post_id() == self.id
245 244
246 @transaction.atomic
247 def add_tag(self, tag):
248 edit_time = timezone.now()
249
250 thread = self.get_thread()
251 thread.add_tag(tag)
252 self.last_edit_time = edit_time
253 self.save(update_fields=['last_edit_time'])
254
255 thread.last_edit_time = edit_time
256 thread.save(update_fields=['last_edit_time'])
257
258 245 @cached_result
259 246 def get_url(self):
260 247 """
@@ -11,7 +11,8 b''
11 11 <p>[i]<i>{% trans 'Italic text' %}</i>[/i]</p>
12 12 <p>[b]<b>{% trans 'Bold text' %}</b>[/b]</p>
13 13 <p>[spoiler]<span class="spoiler">{% trans 'Spoiler' %}</span>[/spoiler]</p>
14 <p>[post]123[/post] -- {% trans 'Link to a post' %}</p>
14 <p>[post]123[/post] {% trans 'Link to a post' %}</p>
15 <p>[thread]123[/thread] — {% trans 'Add post to this thread' %}</p>
15 16 <p>[s]<span class="strikethrough">{% trans 'Strikethrough text' %}</span>[/s]</p>
16 17 <p>[comment]<span class="comment">{% trans 'Comment' %}</span>[/comment]</p>
17 18 <p>[quote]<span class="multiquote">{% trans 'Quote' %}</span>[/quote]</p>
General Comments 0
You need to be logged in to leave comments. Login now