diff --git a/boards/models.py b/boards/models.py --- a/boards/models.py +++ b/boards/models.py @@ -132,6 +132,34 @@ class Post(models.Model): def __unicode__(self): return self.title + ' (' + self.text + ')' + def _get_replies(self): + return Post.objects.filter(parent=self.id) + + def get_reply_count(self): + return len(self._get_replies()) + + def get_images_count(self): + images_count = 1 if self.image else 0 + for reply in self._get_replies(): + if reply.image: + images_count += 1 + + return images_count + + def get_gets_count(self): + gets_count = 1 if self.is_get() else 0 + for reply in self._get_replies(): + if reply.is_get(): + gets_count += 1 + + return gets_count + + def is_get(self): + """If the post has pretty id (1, 1000, 77777), than it is called GET""" + + # TODO Make a better algorithm for describing gets + return self.id == 1 or self.id % 10 == 0 + class Admin(models.Model): """ diff --git a/boards/static/css/base_page.css b/boards/static/css/base_page.css --- a/boards/static/css/base_page.css +++ b/boards/static/css/base_page.css @@ -31,11 +31,11 @@ html { } .link { - color: #829dba; + color: #afdcec; } .link:hover { - color: #ba9f82; + color: #fff380; } .post_id { @@ -68,4 +68,12 @@ html { .form-title { font-weight: bolder; +} + +.metadata { + background: #666; + padding: 10px; + border-radius: 5px; + float: left; + margin-top: 5px; } \ No newline at end of file diff --git a/locale/ru/LC_MESSAGES/django.po b/locale/ru/LC_MESSAGES/django.po --- a/locale/ru/LC_MESSAGES/django.po +++ b/locale/ru/LC_MESSAGES/django.po @@ -3,42 +3,58 @@ # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # -#, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-04-05 20:55+0300\n" +"POT-Creation-Date: 2013-04-11 21:26+0300\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" -"Language: \n" +"Language: ru\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" +#: templates/posting_general.html:22 +msgid "View" +msgstr "Просмотр" + +#: templates/posting_general.html:25 +msgid "replies" +msgstr "ответов" + +#: templates/posting_general.html:26 +msgid "images" +msgstr "изображений" + +#: templates/posting_general.html:29 templates/posting_general.html.py:61 +#: templates/thread.html:23 +msgid "Tags" +msgstr "Теги" + +#: templates/posting_general.html:46 +msgid "Create new thread" +msgstr "Создать новый тред" + +#: templates/posting_general.html:49 templates/thread.html:42 msgid "Title" msgstr "Заголовок" +#: templates/posting_general.html:53 templates/thread.html:46 msgid "Text" msgstr "Текст" +#: templates/posting_general.html:57 templates/thread.html:50 msgid "Image" msgstr "Картинка" +#: templates/posting_general.html:64 templates/thread.html:53 msgid "Post" msgstr "Отправить" -msgid "Tags" -msgstr "Теги" - -msgid "View" -msgstr "Просмотр" - -msgid "Create new thread" -msgstr "Создать новый тред" - +#: templates/thread.html:39 msgid "Reply to the thread" -msgstr "Ответить в тред" \ No newline at end of file +msgstr "Ответить в тред" diff --git a/templates/posting_general.html b/templates/posting_general.html --- a/templates/posting_general.html +++ b/templates/posting_general.html @@ -18,17 +18,22 @@ {{ thread.title }} (#{{ thread.id }}) [{{ thread.pub_time }}] - - [{% trans "View" %}]
+ [{% trans "View" %}]
{{ thread.text|truncatechars:300 }}
- {% if thread.tags %} - {% trans 'Tags' %}: - {% for tag in thread.tags.all %} - - {{ tag.name }} - {% endfor %} - - {% endif %} + {% endfor %} diff --git a/templates/thread.html b/templates/thread.html --- a/templates/thread.html +++ b/templates/thread.html @@ -6,6 +6,7 @@ {% if posts %} {% for post in posts %} +
{% if post.image %}
@@ -16,17 +17,20 @@ {% endif %}
{{ post.title }} - (#{{ post.id }}) + + (#{{ post.id }}) [{{ post.pub_time }}]
{{ post.text }}
- {% ifnotequal post.tags.all|length 0 %} - {% trans 'Tags' %}: - {% for tag in post.tags.all %} - - {{ tag.name }} - {% endfor %} - - {% endifnotequal %} + {% if post.tags.all %} + + {% endif %}
{% endfor %}