diff --git a/boards/templates/boards/feed.html b/boards/templates/boards/feed.html
--- a/boards/templates/boards/feed.html
+++ b/boards/templates/boards/feed.html
@@ -24,6 +24,10 @@
{% get_current_language as LANGUAGE_CODE %}
{% get_current_timezone as TIME_ZONE %}
+ {% for query in queries %}
+
{{ query }}
+ {% endfor %}
+
{% if posts %}
{% if prev_page_link %}
diff --git a/boards/views/feed.py b/boards/views/feed.py
--- a/boards/views/feed.py
+++ b/boards/views/feed.py
@@ -13,6 +13,7 @@ POSTS_PER_PAGE = settings.get_int('View'
PARAMETER_CURRENT_PAGE = 'current_page'
PARAMETER_PAGINATOR = 'paginator'
PARAMETER_POSTS = 'posts'
+PARAMETER_QUERIES = 'queries'
PARAMETER_PREV_LINK = 'prev_page_link'
PARAMETER_NEXT_LINK = 'next_page_link'
@@ -26,6 +27,10 @@ class FeedFilter:
def get_filtered_posts(request, posts):
return posts
+ @staticmethod
+ def get_query(request):
+ return None
+
class TripcodeFilter(FeedFilter):
@staticmethod
@@ -36,6 +41,12 @@ class TripcodeFilter(FeedFilter):
filtered_posts = filtered_posts.filter(tripcode=tripcode)
return filtered_posts
+ @staticmethod
+ def get_query(request):
+ tripcode = request.GET.get('tripcode', None)
+ if tripcode:
+ return 'Tripcode: {}'.format(tripcode)
+
class FavoritesFilter(FeedFilter):
@staticmethod
@@ -61,6 +72,12 @@ class IpFilter(FeedFilter):
filtered_posts = filtered_posts.filter(poster_ip=ip)
return filtered_posts
+ @staticmethod
+ def get_query(request):
+ ip = request.GET.get('ip', None)
+ if ip:
+ return 'IP: {}'.format(ip)
+
class HashFilter(FeedFilter):
@staticmethod
@@ -72,6 +89,12 @@ class HashFilter(FeedFilter):
filtered_posts = filtered_posts.filter(attachments__hash=image_hash)
return filtered_posts
+ @staticmethod
+ def get_query(request):
+ image_hash = request.GET.get('image_hash', None)
+ if image_hash:
+ return 'Hash: {}'.format(image_hash)
+
class FeedView(PostMixin, BaseBoardView):
filters = (
@@ -91,8 +114,13 @@ class FeedView(PostMixin, BaseBoardView)
posts = Post.objects.exclude(
thread__tags__in=settings_manager.get_hidden_tags()).order_by(
'-pub_time').prefetch_related('attachments', 'thread')
+ queries = []
for filter in self.filters:
posts = filter.get_filtered_posts(request, posts)
+ query = filter.get_query(request)
+ if query:
+ queries.append(query)
+ params[PARAMETER_QUERIES] = queries
paginator = get_paginator(posts, POSTS_PER_PAGE)
paginator.current_page = int(page)