# HG changeset patch # User neko259 # Date 2015-03-29 13:25:04 # Node ID fbac3cd522e60b3144fbcde0e16f30babce5f22d # Parent 5357cb86edbaffcb714422e3351ef1d5e0a81529 Post model code refacoring. Added help on the "thread" parser tag diff --git a/boards/locale/ru/LC_MESSAGES/django.mo b/boards/locale/ru/LC_MESSAGES/django.mo index 3b0892c98694efec3108e78f8d21f3ef08f59ff7..34c16f9e0e0a9b30a8f68a6aba9d15d6f0d53db3 GIT binary patch literal 6760 zc$|$_eQ*?K8Gl==l1mJbgwoX3zG$J)_KrJfYdHuIAV5mK$VZ*lkId$7Nw!>eue*DJ zXvYan5o%&nv5uW;rC_apbUKERKte*O|2aB3yW>BOj#Wp;I-_H!{_n@{d7pRhE+ou! z;r6%h$Md|;$M1P|^Ipvz-xavJ@w*4Vh1-RA7Wk!)3w6m)3b7uz0Z3CjfR(^KK>Qa+ zaQg(X3s?bs8W;m+^}2)GTHp!bI^c`IJAmhbtAKB6eeVD_0_XJlAAwcCziRwYpZ{Nd z&K(ezz-r(I;8tKg@aQVmcUksf)|aecJ9k&G|NHg$i3--!Ucvr9t@rm;u>E;GKcvTBui*1v&~mS6J?FLF zH!CKJ#PZ*fVnF6@08y6VioH<2fP#bW8l@>z*pd782iS;G06zols9`@G zU>rE1$Jc?iz(3Tm9UsiGOW)v^5_=zVL~vE2RZ*uSlM+yy)f{E8mG4{W6R zTgU!Aawqek8@Qd~2JEGJzLWKS2s}dhMYDRD;bF#z6hEpBipyTXeW+P*U6F51 zWG8;@g1JZiprOo$I*t3v=5`CNmrlWbgf6NJDY#D%cgX+G3(gl^#4qXrR9_TxdY^RQ zcSta&YxTZX!L=J*)f)F}+@`T!V@hz1-lNCFr=5cP2<3$O8gcOn!8waA;{QYVCGk5T zxZbD-b&I7Jy{|-LHY@Xv=S$y_{($A-=9)$p^MjTx8gn^4;fcnAKj65Y*k{eldf}J&8ESRDxYx(LX zeWPDL@ct$X>#jOLI zF)L&EmScOOJ#X5ggN{jy4l z#*SzCjyo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v9Yq<<&2qf-3A?Nk=2R6kqbQNe>pAXDs+EUl z6o;;1eN=U*rB!)>IwA#{CMXak(oPb4A_~lxT2Zlz==D^_@g;O$vArr?SCzH%TmzCR zf<8b~N+SZfynU}!U^6RLx{BY$l7nTsBAXyy)utS^K{@e zfEu|vVTM)GQR>A8HVAwVPoqH;-!8@ewGe%3C>vN*Q)hx(!L&Lo za)^DVT#rK4w36kQSlOd~pOJAqsXsF=6DQ75`WKX9D#JWAOOvr(1Jr~t!BZljWm4l?6u3ejYEmj3F2(rMZZMpHQi^R#cpk4E)w znnI~v;lPk4Nn(@BK2o)Z^uiHjH4g=aRB4~1U}1uLfx2H(Z-+D30CukUD!s*SS^67G zP@lltg9NS;^GIk}L98&P$j{$S3rNAdV)!gqcCpi?%DP@Jnb@nmIHih}xJ1!9-K)tu GCH@cgB?5B* diff --git a/boards/locale/ru/LC_MESSAGES/django.po b/boards/locale/ru/LC_MESSAGES/django.po --- a/boards/locale/ru/LC_MESSAGES/django.po +++ b/boards/locale/ru/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-03-26 20:40+0200\n" +"POT-Creation-Date: 2015-03-29 16:19+0300\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -265,7 +265,7 @@ msgstr "Синтаксис текста" msgid "Pages:" msgstr "Страницы: " -#: templates/boards/preview.html:6 templates/boards/staticpages/help.html:19 +#: templates/boards/preview.html:6 templates/boards/staticpages/help.html:20 msgid "Preview" msgstr "Предпросмотр" @@ -319,18 +319,22 @@ msgid "Link to a post" msgstr "Ссылка на сообщение" #: templates/boards/staticpages/help.html:15 +msgid "Add post to this thread" +msgstr "Добавить сообщение в эту тему" + +#: templates/boards/staticpages/help.html:16 msgid "Strikethrough text" msgstr "Зачеркнутый текст" -#: templates/boards/staticpages/help.html:16 +#: templates/boards/staticpages/help.html:17 msgid "Comment" msgstr "Комментарий" -#: templates/boards/staticpages/help.html:17 +#: templates/boards/staticpages/help.html:18 msgid "Quote" msgstr "Цитата" -#: templates/boards/staticpages/help.html:19 +#: templates/boards/staticpages/help.html:20 msgid "You can try pasting the text and previewing the result here:" msgstr "Вы можете попробовать вставить текст и проверить результат здесь:" diff --git a/boards/models/post.py b/boards/models/post.py --- a/boards/models/post.py +++ b/boards/models/post.py @@ -87,7 +87,7 @@ class PostManager(models.Manager): posting_time = timezone.now() if not thread: thread = boards.models.thread.Thread.objects.create( - bump_time=posting_time, last_edit_time=posting_time) + bump_time=posting_time, last_edit_time=posting_time) new_thread = True else: new_thread = False @@ -223,10 +223,9 @@ class Post(models.Model, Viewable): Builds a replies map string from replies list. This is a cache to stop the server from recalculating the map on every post show. """ - map_string = '' post_urls = ['>>{}'.format( - refpost.get_url(), refpost.id) for refpost in self.referenced_posts.all()] + refpost.get_url(), refpost.id) for refpost in self.referenced_posts.all()] self.refmap = ', '.join(post_urls) @@ -243,18 +242,6 @@ class Post(models.Model, Viewable): return self.get_thread().get_opening_post_id() == self.id - @transaction.atomic - def add_tag(self, tag): - edit_time = timezone.now() - - thread = self.get_thread() - thread.add_tag(tag) - self.last_edit_time = edit_time - self.save(update_fields=['last_edit_time']) - - thread.last_edit_time = edit_time - thread.save(update_fields=['last_edit_time']) - @cached_result def get_url(self): """ diff --git a/boards/templates/boards/staticpages/help.html b/boards/templates/boards/staticpages/help.html --- a/boards/templates/boards/staticpages/help.html +++ b/boards/templates/boards/staticpages/help.html @@ -11,7 +11,8 @@

[i]{% trans 'Italic text' %}[/i]

[b]{% trans 'Bold text' %}[/b]

[spoiler]{% trans 'Spoiler' %}[/spoiler]

-

[post]123[/post] -- {% trans 'Link to a post' %}

+

[post]123[/post] — {% trans 'Link to a post' %}

+

[thread]123[/thread] — {% trans 'Add post to this thread' %}

[s]{% trans 'Strikethrough text' %}[/s]

[comment]{% trans 'Comment' %}[/comment]

[quote]{% trans 'Quote' %}[/quote]