Show More
@@ -115,7 +115,8 b' class PostManager(models.Manager):' | |||||
115 | posts = self.filter(poster_ip=ip) |
|
115 | posts = self.filter(poster_ip=ip) | |
116 | map(self.delete_post, posts) |
|
116 | map(self.delete_post, posts) | |
117 |
|
117 | |||
118 | # TODO Move this method to thread manager |
|
118 | # TODO This method may not be needed any more, because django's paginator | |
|
119 | # is used | |||
119 | def get_threads(self, tag=None, page=ALL_PAGES, |
|
120 | def get_threads(self, tag=None, page=ALL_PAGES, | |
120 | order_by='-bump_time', archived=False): |
|
121 | order_by='-bump_time', archived=False): | |
121 | if tag: |
|
122 | if tag: |
@@ -36,6 +36,8 b' def all_tags(request):' | |||||
36 | return render(request, 'boards/tags.html', context) |
|
36 | return render(request, 'boards/tags.html', context) | |
37 |
|
37 | |||
38 |
|
38 | |||
|
39 | # TODO Maybe this jumper is not needed any more? Only as a hack to find some | |||
|
40 | # post without knowing its thread | |||
39 | def jump_to_post(request, post_id): |
|
41 | def jump_to_post(request, post_id): | |
40 | """Determine thread in which the requested post is and open it's page""" |
|
42 | """Determine thread in which the requested post is and open it's page""" | |
41 |
|
43 |
@@ -122,4 +122,4 b' class AllThreadsView(PostMixin, BaseBoar' | |||||
122 | return redirect('thread', post_id=thread_to_show) |
|
122 | return redirect('thread', post_id=thread_to_show) | |
123 |
|
123 | |||
124 | def get_threads(self): |
|
124 | def get_threads(self): | |
125 | return Thread.objects.filter(archived=False) |
|
125 | return Thread.objects.filter(archived=False).order_by('-bump_time') |
@@ -12,7 +12,7 b' class TagView(AllThreadsView):' | |||||
12 | def get_threads(self): |
|
12 | def get_threads(self): | |
13 | tag = get_object_or_404(Tag, name=self.tag_name) |
|
13 | tag = get_object_or_404(Tag, name=self.tag_name) | |
14 |
|
14 | |||
15 | return tag.threads.filter(archived=False) |
|
15 | return tag.threads.filter(archived=False).order_by('-bump_time') | |
16 |
|
16 | |||
17 | def get_context_data(self, **kwargs): |
|
17 | def get_context_data(self, **kwargs): | |
18 | context = super(TagView, self).get_context_data(**kwargs) |
|
18 | context = super(TagView, self).get_context_data(**kwargs) | |
@@ -25,4 +25,4 b' class TagView(AllThreadsView):' | |||||
25 | def get(self, request, tag_name, page=DEFAULT_PAGE): |
|
25 | def get(self, request, tag_name, page=DEFAULT_PAGE): | |
26 | self.tag_name = tag_name |
|
26 | self.tag_name = tag_name | |
27 |
|
27 | |||
28 | return super(TagView, self).get(request, page) No newline at end of file |
|
28 | return super(TagView, self).get(request, page) |
General Comments 0
You need to be logged in to leave comments.
Login now