Show More
@@ -132,6 +132,34 b' class Post(models.Model):' | |||||
132 | def __unicode__(self): |
|
132 | def __unicode__(self): | |
133 | return self.title + ' (' + self.text + ')' |
|
133 | return self.title + ' (' + self.text + ')' | |
134 |
|
134 | |||
|
135 | def _get_replies(self): | |||
|
136 | return Post.objects.filter(parent=self.id) | |||
|
137 | ||||
|
138 | def get_reply_count(self): | |||
|
139 | return len(self._get_replies()) | |||
|
140 | ||||
|
141 | def get_images_count(self): | |||
|
142 | images_count = 1 if self.image else 0 | |||
|
143 | for reply in self._get_replies(): | |||
|
144 | if reply.image: | |||
|
145 | images_count += 1 | |||
|
146 | ||||
|
147 | return images_count | |||
|
148 | ||||
|
149 | def get_gets_count(self): | |||
|
150 | gets_count = 1 if self.is_get() else 0 | |||
|
151 | for reply in self._get_replies(): | |||
|
152 | if reply.is_get(): | |||
|
153 | gets_count += 1 | |||
|
154 | ||||
|
155 | return gets_count | |||
|
156 | ||||
|
157 | def is_get(self): | |||
|
158 | """If the post has pretty id (1, 1000, 77777), than it is called GET""" | |||
|
159 | ||||
|
160 | # TODO Make a better algorithm for describing gets | |||
|
161 | return self.id == 1 or self.id % 10 == 0 | |||
|
162 | ||||
135 |
|
163 | |||
136 | class Admin(models.Model): |
|
164 | class Admin(models.Model): | |
137 | """ |
|
165 | """ |
@@ -31,11 +31,11 b' html {' | |||||
31 | } |
|
31 | } | |
32 |
|
32 | |||
33 | .link { |
|
33 | .link { | |
34 |
color: # |
|
34 | color: #afdcec; | |
35 | } |
|
35 | } | |
36 |
|
36 | |||
37 | .link:hover { |
|
37 | .link:hover { | |
38 |
color: # |
|
38 | color: #fff380; | |
39 | } |
|
39 | } | |
40 |
|
40 | |||
41 | .post_id { |
|
41 | .post_id { | |
@@ -68,4 +68,12 b' html {' | |||||
68 |
|
68 | |||
69 | .form-title { |
|
69 | .form-title { | |
70 | font-weight: bolder; |
|
70 | font-weight: bolder; | |
|
71 | } | |||
|
72 | ||||
|
73 | .metadata { | |||
|
74 | background: #666; | |||
|
75 | padding: 10px; | |||
|
76 | border-radius: 5px; | |||
|
77 | float: left; | |||
|
78 | margin-top: 5px; | |||
71 | } No newline at end of file |
|
79 | } |
@@ -3,42 +3,58 b'' | |||||
3 | # This file is distributed under the same license as the PACKAGE package. |
|
3 | # This file is distributed under the same license as the PACKAGE package. | |
4 | # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. |
|
4 | # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. | |
5 | # |
|
5 | # | |
6 | #, fuzzy |
|
|||
7 | msgid "" |
|
6 | msgid "" | |
8 | msgstr "" |
|
7 | msgstr "" | |
9 | "Project-Id-Version: PACKAGE VERSION\n" |
|
8 | "Project-Id-Version: PACKAGE VERSION\n" | |
10 | "Report-Msgid-Bugs-To: \n" |
|
9 | "Report-Msgid-Bugs-To: \n" | |
11 |
"POT-Creation-Date: 2013-04- |
|
10 | "POT-Creation-Date: 2013-04-11 21:26+0300\n" | |
12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
|
11 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | |
13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
|
12 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | |
14 | "Language-Team: LANGUAGE <LL@li.org>\n" |
|
13 | "Language-Team: LANGUAGE <LL@li.org>\n" | |
15 | "Language: \n" |
|
14 | "Language: ru\n" | |
16 | "MIME-Version: 1.0\n" |
|
15 | "MIME-Version: 1.0\n" | |
17 | "Content-Type: text/plain; charset=UTF-8\n" |
|
16 | "Content-Type: text/plain; charset=UTF-8\n" | |
18 | "Content-Transfer-Encoding: 8bit\n" |
|
17 | "Content-Transfer-Encoding: 8bit\n" | |
19 | "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" |
|
18 | "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" | |
20 | "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" |
|
19 | "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" | |
21 |
|
20 | |||
|
21 | #: templates/posting_general.html:22 | |||
|
22 | msgid "View" | |||
|
23 | msgstr "ΠΡΠΎΡΠΌΠΎΡΡ" | |||
|
24 | ||||
|
25 | #: templates/posting_general.html:25 | |||
|
26 | msgid "replies" | |||
|
27 | msgstr "ΠΎΡΠ²Π΅ΡΠΎΠ²" | |||
|
28 | ||||
|
29 | #: templates/posting_general.html:26 | |||
|
30 | msgid "images" | |||
|
31 | msgstr "ΠΈΠ·ΠΎΠ±ΡΠ°ΠΆΠ΅Π½ΠΈΠΉ" | |||
|
32 | ||||
|
33 | #: templates/posting_general.html:29 templates/posting_general.html.py:61 | |||
|
34 | #: templates/thread.html:23 | |||
|
35 | msgid "Tags" | |||
|
36 | msgstr "Π’Π΅Π³ΠΈ" | |||
|
37 | ||||
|
38 | #: templates/posting_general.html:46 | |||
|
39 | msgid "Create new thread" | |||
|
40 | msgstr "Π‘ΠΎΠ·Π΄Π°ΡΡ Π½ΠΎΠ²ΡΠΉ ΡΡΠ΅Π΄" | |||
|
41 | ||||
|
42 | #: templates/posting_general.html:49 templates/thread.html:42 | |||
22 | msgid "Title" |
|
43 | msgid "Title" | |
23 | msgstr "ΠΠ°Π³ΠΎΠ»ΠΎΠ²ΠΎΠΊ" |
|
44 | msgstr "ΠΠ°Π³ΠΎΠ»ΠΎΠ²ΠΎΠΊ" | |
24 |
|
45 | |||
|
46 | #: templates/posting_general.html:53 templates/thread.html:46 | |||
25 | msgid "Text" |
|
47 | msgid "Text" | |
26 | msgstr "Π’Π΅ΠΊΡΡ" |
|
48 | msgstr "Π’Π΅ΠΊΡΡ" | |
27 |
|
49 | |||
|
50 | #: templates/posting_general.html:57 templates/thread.html:50 | |||
28 | msgid "Image" |
|
51 | msgid "Image" | |
29 | msgstr "ΠΠ°ΡΡΠΈΠ½ΠΊΠ°" |
|
52 | msgstr "ΠΠ°ΡΡΠΈΠ½ΠΊΠ°" | |
30 |
|
53 | |||
|
54 | #: templates/posting_general.html:64 templates/thread.html:53 | |||
31 | msgid "Post" |
|
55 | msgid "Post" | |
32 | msgstr "ΠΡΠΏΡΠ°Π²ΠΈΡΡ" |
|
56 | msgstr "ΠΡΠΏΡΠ°Π²ΠΈΡΡ" | |
33 |
|
57 | |||
34 | msgid "Tags" |
|
58 | #: templates/thread.html:39 | |
35 | msgstr "Π’Π΅Π³ΠΈ" |
|
|||
36 |
|
||||
37 | msgid "View" |
|
|||
38 | msgstr "ΠΡΠΎΡΠΌΠΎΡΡ" |
|
|||
39 |
|
||||
40 | msgid "Create new thread" |
|
|||
41 | msgstr "Π‘ΠΎΠ·Π΄Π°ΡΡ Π½ΠΎΠ²ΡΠΉ ΡΡΠ΅Π΄" |
|
|||
42 |
|
||||
43 | msgid "Reply to the thread" |
|
59 | msgid "Reply to the thread" | |
44 | msgstr "ΠΡΠ²Π΅ΡΠΈΡΡ Π² ΡΡΠ΅Π΄" No newline at end of file |
|
60 | msgstr "ΠΡΠ²Π΅ΡΠΈΡΡ Π² ΡΡΠ΅Π΄" |
@@ -18,17 +18,22 b'' | |||||
18 | <span class="title">{{ thread.title }}</span> |
|
18 | <span class="title">{{ thread.title }}</span> | |
19 | <span class="post_id">(#{{ thread.id }})</span> |
|
19 | <span class="post_id">(#{{ thread.id }})</span> | |
20 | [{{ thread.pub_time }}] |
|
20 | [{{ thread.pub_time }}] | |
21 | <a class="link" href="/thread/{{ thread.id }}/"> |
|
21 | [<a class="link" href="/thread/{{ thread.id }}/">{% trans "View" %}</a>]<br /> | |
22 | [{% trans "View" %}]</a><br /> |
|
|||
23 | {{ thread.text|truncatechars:300 }}<br /> |
|
22 | {{ thread.text|truncatechars:300 }}<br /> | |
24 | {% if thread.tags %} |
|
23 | <div class="metadata"> | |
25 | <span class="tags">{% trans 'Tags' %}: |
|
24 | ({{ thread.get_reply_count }} {% trans 'replies' %}, | |
26 | {% for tag in thread.tags.all %} |
|
25 | {{ thread.get_images_count }} {% trans 'images' %}, | |
27 | <a class="tag" href="/tag/{{ tag.name }}"> |
|
26 | {{ thread.get_gets_count }} {% trans 'gets' %}) | |
28 |
|
|
27 | <br /> | |
29 |
|
|
28 | {% if thread.tags.all %} | |
30 | </span> |
|
29 | <span class="tags">{% trans 'Tags' %}: | |
31 | {% endif %} |
|
30 | {% for tag in thread.tags.all %} | |
|
31 | <a class="tag" href="/tag/{{ tag.name }}"> | |||
|
32 | {{ tag.name }}</a> | |||
|
33 | {% endfor %} | |||
|
34 | </span> | |||
|
35 | {% endif %} | |||
|
36 | </div> | |||
32 | </div> |
|
37 | </div> | |
33 | </div> |
|
38 | </div> | |
34 | {% endfor %} |
|
39 | {% endfor %} |
@@ -6,6 +6,7 b'' | |||||
6 |
|
6 | |||
7 | {% if posts %} |
|
7 | {% if posts %} | |
8 | {% for post in posts %} |
|
8 | {% for post in posts %} | |
|
9 | <a name="{{ post.id }}"></a> | |||
9 | <div class="post"> |
|
10 | <div class="post"> | |
10 | {% if post.image %} |
|
11 | {% if post.image %} | |
11 | <div class="block"> |
|
12 | <div class="block"> | |
@@ -16,17 +17,20 b'' | |||||
16 | {% endif %} |
|
17 | {% endif %} | |
17 | <div class="block"> |
|
18 | <div class="block"> | |
18 | <span class="title">{{ post.title }}</span> |
|
19 | <span class="title">{{ post.title }}</span> | |
19 |
< |
|
20 | <a class="post_id" href="#{{ post.id }}"> | |
|
21 | (#{{ post.id }})</a> | |||
20 | [{{ post.pub_time }}]<br /> |
|
22 | [{{ post.pub_time }}]<br /> | |
21 | {{ post.text }}<br /> |
|
23 | {{ post.text }}<br /> | |
22 |
{% if |
|
24 | {% if post.tags.all %} | |
23 |
< |
|
25 | <div class="metadata"> | |
24 |
|
|
26 | <span class="tags">{% trans 'Tags' %}: | |
25 | <a class="tag" href="/tag/{{ tag.name }}"> |
|
27 | {% for tag in post.tags.all %} | |
26 |
|
|
28 | <a class="tag" href="/tag/{{ tag.name }}"> | |
27 |
|
|
29 | {{ tag.name }}</a> | |
28 |
|
|
30 | {% endfor %} | |
29 | {% endifnotequal %} |
|
31 | </span> | |
|
32 | </div> | |||
|
33 | {% endif %} | |||
30 | </div> |
|
34 | </div> | |
31 | </div> |
|
35 | </div> | |
32 | {% endfor %} |
|
36 | {% endfor %} |
General Comments 0
You need to be logged in to leave comments.
Login now