Show More
@@ -24,6 +24,10 b'' | |||
|
24 | 24 | {% get_current_language as LANGUAGE_CODE %} |
|
25 | 25 | {% get_current_timezone as TIME_ZONE %} |
|
26 | 26 | |
|
27 | {% for query in queries %} | |
|
28 | <div class="image-mode-tab">{{ query }}</div> | |
|
29 | {% endfor %} | |
|
30 | ||
|
27 | 31 | {% if posts %} |
|
28 | 32 | {% if prev_page_link %} |
|
29 | 33 | <div class="page_link"> |
@@ -13,6 +13,7 b" POSTS_PER_PAGE = settings.get_int('View'" | |||
|
13 | 13 | PARAMETER_CURRENT_PAGE = 'current_page' |
|
14 | 14 | PARAMETER_PAGINATOR = 'paginator' |
|
15 | 15 | PARAMETER_POSTS = 'posts' |
|
16 | PARAMETER_QUERIES = 'queries' | |
|
16 | 17 | |
|
17 | 18 | PARAMETER_PREV_LINK = 'prev_page_link' |
|
18 | 19 | PARAMETER_NEXT_LINK = 'next_page_link' |
@@ -26,6 +27,10 b' class FeedFilter:' | |||
|
26 | 27 | def get_filtered_posts(request, posts): |
|
27 | 28 | return posts |
|
28 | 29 | |
|
30 | @staticmethod | |
|
31 | def get_query(request): | |
|
32 | return None | |
|
33 | ||
|
29 | 34 | |
|
30 | 35 | class TripcodeFilter(FeedFilter): |
|
31 | 36 | @staticmethod |
@@ -36,6 +41,12 b' class TripcodeFilter(FeedFilter):' | |||
|
36 | 41 | filtered_posts = filtered_posts.filter(tripcode=tripcode) |
|
37 | 42 | return filtered_posts |
|
38 | 43 | |
|
44 | @staticmethod | |
|
45 | def get_query(request): | |
|
46 | tripcode = request.GET.get('tripcode', None) | |
|
47 | if tripcode: | |
|
48 | return 'Tripcode: {}'.format(tripcode) | |
|
49 | ||
|
39 | 50 | |
|
40 | 51 | class FavoritesFilter(FeedFilter): |
|
41 | 52 | @staticmethod |
@@ -61,6 +72,12 b' class IpFilter(FeedFilter):' | |||
|
61 | 72 | filtered_posts = filtered_posts.filter(poster_ip=ip) |
|
62 | 73 | return filtered_posts |
|
63 | 74 | |
|
75 | @staticmethod | |
|
76 | def get_query(request): | |
|
77 | ip = request.GET.get('ip', None) | |
|
78 | if ip: | |
|
79 | return 'IP: {}'.format(ip) | |
|
80 | ||
|
64 | 81 | |
|
65 | 82 | class HashFilter(FeedFilter): |
|
66 | 83 | @staticmethod |
@@ -72,6 +89,12 b' class HashFilter(FeedFilter):' | |||
|
72 | 89 | filtered_posts = filtered_posts.filter(attachments__hash=image_hash) |
|
73 | 90 | return filtered_posts |
|
74 | 91 | |
|
92 | @staticmethod | |
|
93 | def get_query(request): | |
|
94 | image_hash = request.GET.get('image_hash', None) | |
|
95 | if image_hash: | |
|
96 | return 'Hash: {}'.format(image_hash) | |
|
97 | ||
|
75 | 98 | |
|
76 | 99 | class FeedView(PostMixin, BaseBoardView): |
|
77 | 100 | filters = ( |
@@ -91,8 +114,13 b' class FeedView(PostMixin, BaseBoardView)' | |||
|
91 | 114 | posts = Post.objects.exclude( |
|
92 | 115 | thread__tags__in=settings_manager.get_hidden_tags()).order_by( |
|
93 | 116 | '-pub_time').prefetch_related('attachments', 'thread') |
|
117 | queries = [] | |
|
94 | 118 | for filter in self.filters: |
|
95 | 119 | posts = filter.get_filtered_posts(request, posts) |
|
120 | query = filter.get_query(request) | |
|
121 | if query: | |
|
122 | queries.append(query) | |
|
123 | params[PARAMETER_QUERIES] = queries | |
|
96 | 124 | |
|
97 | 125 | paginator = get_paginator(posts, POSTS_PER_PAGE) |
|
98 | 126 | paginator.current_page = int(page) |
General Comments 0
You need to be logged in to leave comments.
Login now