diff --git a/boards/templates/boards/base.html b/boards/templates/boards/base.html --- a/boards/templates/boards/base.html +++ b/boards/templates/boards/base.html @@ -42,7 +42,7 @@ {% trans 'feed' %}, {% trans 'random' %}{% if has_fav_threads %}, - {% trans 'favorites' %} {{ new_post_count }} + {% trans 'favorites' %} {{ new_post_count }} {% endif %} {% if usernames %} diff --git a/boards/views/feed.py b/boards/views/feed.py --- a/boards/views/feed.py +++ b/boards/views/feed.py @@ -12,7 +12,6 @@ POSTS_PER_PAGE = 10 PARAMETER_CURRENT_PAGE = 'current_page' PARAMETER_PAGINATOR = 'paginator' PARAMETER_POSTS = 'posts' -PARAMETER_ADDITONAL_ATTRS = 'additional_attrs' PARAMETER_PREV_LINK = 'prev_page_link' PARAMETER_NEXT_LINK = 'next_page_link' @@ -26,6 +25,7 @@ class FeedView(PostMixin, BaseBoardView) def get(self, request): page = request.GET.get('page', DEFAULT_PAGE) tripcode = request.GET.get('tripcode', None) + favorites = 'favorites' in request.GET params = self.get_context_data(request=request) @@ -36,17 +36,16 @@ class FeedView(PostMixin, BaseBoardView) '-pub_time').prefetch_related('images', 'thread', 'threads') if tripcode: posts = posts.filter(tripcode=tripcode) + if favorites: + fav_thread_ops = Post.objects.filter(id__in=settings_manager.get_fav_threads().keys()) + fav_threads = [op.get_thread() for op in fav_thread_ops] + posts = posts.filter(threads__in=fav_threads) paginator = get_paginator(posts, POSTS_PER_PAGE) paginator.current_page = int(page) params[PARAMETER_POSTS] = paginator.page(page).object_list - additional_params = dict() - if tripcode: - additional_params['tripcode'] = tripcode - params[PARAMETER_ADDITONAL_ATTRS] = '&tripcode=' + tripcode - paginator.set_url(reverse('feed'), request.GET.dict()) self.get_page_context(paginator, params, page)