Show More
@@ -45,10 +45,10 b' class PostManager(models.Manager):' | |||||
45 | self.delete_post(post) |
|
45 | self.delete_post(post) | |
46 |
|
46 | |||
47 | def get_threads(self, tag=None): |
|
47 | def get_threads(self, tag=None): | |
48 |
if tag |
|
48 | if tag: | |
|
49 | threads = self.filter(parent=NO_PARENT, tags=tag) | |||
|
50 | else: | |||
49 | threads = self.filter(parent=NO_PARENT) |
|
51 | threads = self.filter(parent=NO_PARENT) | |
50 | else: |
|
|||
51 | threads = self.filter(parent=NO_PARENT, tag=tag) |
|
|||
52 | threads = list(threads.order_by('-last_edit_time')) |
|
52 | threads = list(threads.order_by('-last_edit_time')) | |
53 |
|
53 | |||
54 | return threads |
|
54 | return threads |
@@ -65,7 +65,7 b' def tag(request, tag_name):' | |||||
65 | """Get all tag threads (posts without a parent).""" |
|
65 | """Get all tag threads (posts without a parent).""" | |
66 |
|
66 | |||
67 | tag = Tag.objects.get(name=tag_name) |
|
67 | tag = Tag.objects.get(name=tag_name) | |
68 |
threads = |
|
68 | threads = Post.objects.get_threads(tag=tag) | |
69 |
|
69 | |||
70 | if request.method == 'POST': |
|
70 | if request.method == 'POST': | |
71 | return new_post(request) |
|
71 | return new_post(request) |
@@ -19,7 +19,7 b'' | |||||
19 | [{{ thread.pub_time }}] |
|
19 | [{{ thread.pub_time }}] | |
20 | <a class="link" href="/thread/{{ thread.id }}/"> |
|
20 | <a class="link" href="/thread/{{ thread.id }}/"> | |
21 | [{% trans "View" %}]</a><br /> |
|
21 | [{% trans "View" %}]</a><br /> | |
22 | {{ thread.text }}<br /> |
|
22 | {{ thread.text|truncatechars:300 }}<br /> | |
23 | {% if thread.tags %} |
|
23 | {% if thread.tags %} | |
24 | <span class="tags">{% trans 'Tags' %}: |
|
24 | <span class="tags">{% trans 'Tags' %}: | |
25 | {% for tag in thread.tags.all %} |
|
25 | {% for tag in thread.tags.all %} |
General Comments 0
You need to be logged in to leave comments.
Login now