Show More
@@ -116,6 +116,10 b' class Tag(models.Model):' | |||||
116 | def __unicode__(self): |
|
116 | def __unicode__(self): | |
117 | return self.name |
|
117 | return self.name | |
118 |
|
118 | |||
|
119 | def is_empty(self): | |||
|
120 | posts_with_tag = Post.objects.get_threads(tag=self) | |||
|
121 | return len(posts_with_tag) == 0 | |||
|
122 | ||||
119 |
|
123 | |||
120 | class Post(models.Model): |
|
124 | class Post(models.Model): | |
121 | """A post is a message.""" |
|
125 | """A post is a message.""" |
@@ -71,7 +71,6 b' html {' | |||||
71 | } |
|
71 | } | |
72 |
|
72 | |||
73 | .metadata { |
|
73 | .metadata { | |
74 | float: left; |
|
|||
75 | padding: 2px; |
|
74 | padding: 2px; | |
76 | margin-top: 10px; |
|
75 | margin-top: 10px; | |
77 | border: solid 1px #666; |
|
76 | border: solid 1px #666; |
@@ -22,6 +22,7 b'' | |||||
22 | >{% trans "View" %}</a>]<br /> |
|
22 | >{% trans "View" %}</a>]<br /> | |
23 | {{ thread.get_parsed_text|linebreaksbr|truncatechars:300 }}<br |
|
23 | {{ thread.get_parsed_text|linebreaksbr|truncatechars:300 }}<br | |
24 | /> |
|
24 | /> | |
|
25 | </div> | |||
25 | <div class="metadata"> |
|
26 | <div class="metadata"> | |
26 | {{ thread.get_reply_count }} {% trans 'replies' %}, |
|
27 | {{ thread.get_reply_count }} {% trans 'replies' %}, | |
27 | {{ thread.get_images_count }} {% trans 'images' %}, |
|
28 | {{ thread.get_images_count }} {% trans 'images' %}, | |
@@ -37,7 +38,6 b'' | |||||
37 | {% endif %} |
|
38 | {% endif %} | |
38 | </div> |
|
39 | </div> | |
39 | </div> |
|
40 | </div> | |
40 | </div> |
|
|||
41 | {% endfor %} |
|
41 | {% endfor %} | |
42 | {% else %} |
|
42 | {% else %} | |
43 | No threads found. |
|
43 | No threads found. |
@@ -21,17 +21,17 b'' | |||||
21 | (#{{ post.id }})</a> |
|
21 | (#{{ post.id }})</a> | |
22 | [{{ post.pub_time }}]<br /> |
|
22 | [{{ post.pub_time }}]<br /> | |
23 | {{ post.get_parsed_text|linebreaksbr }}<br /> |
|
23 | {{ post.get_parsed_text|linebreaksbr }}<br /> | |
24 | {% if post.tags.all %} |
|
|||
25 | <div class="metadata"> |
|
|||
26 | <span class="tags">{% trans 'Tags' %}: |
|
|||
27 | {% for tag in post.tags.all %} |
|
|||
28 | <a class="tag" href="{% url 'tag' tag.name %}"> |
|
|||
29 | {{ tag.name }}</a> |
|
|||
30 | {% endfor %} |
|
|||
31 | </span> |
|
|||
32 | </div> |
|
|||
33 | {% endif %} |
|
|||
34 | </div> |
|
24 | </div> | |
|
25 | {% if post.tags.all %} | |||
|
26 | <div class="metadata"> | |||
|
27 | <span class="tags">{% trans 'Tags' %}: | |||
|
28 | {% for tag in post.tags.all %} | |||
|
29 | <a class="tag" href="{% url 'tag' tag.name %}"> | |||
|
30 | {{ tag.name }}</a> | |||
|
31 | {% endfor %} | |||
|
32 | </span> | |||
|
33 | </div> | |||
|
34 | {% endif %} | |||
35 | </div> |
|
35 | </div> | |
36 | {% endfor %} |
|
36 | {% endfor %} | |
37 | {% else %} |
|
37 | {% else %} |
General Comments 0
You need to be logged in to leave comments.
Login now