Show More
@@ -42,7 +42,7 b'' | |||||
42 | <a href="{% url 'feed' %}" title="{% trans 'Feed' %}">{% trans 'feed' %}</a>, |
|
42 | <a href="{% url 'feed' %}" title="{% trans 'Feed' %}">{% trans 'feed' %}</a>, | |
43 | <a href="{% url 'random' %}" title="{% trans 'Random images' %}">{% trans 'random' %}</a>{% if has_fav_threads %}, |
|
43 | <a href="{% url 'random' %}" title="{% trans 'Random images' %}">{% trans 'random' %}</a>{% if has_fav_threads %}, | |
44 |
|
44 | |||
45 |
<a href=" |
|
45 | <a href="{% url 'feed' %}?favorites" id="fav-panel-btn">{% trans 'favorites' %} <span id="new-fav-post-count" {% if not new_post_count %}style="display: none" {% endif %}>{{ new_post_count }}</span></a> | |
46 | {% endif %} |
|
46 | {% endif %} | |
47 |
|
47 | |||
48 | {% if usernames %} |
|
48 | {% if usernames %} |
@@ -12,7 +12,6 b' POSTS_PER_PAGE = 10' | |||||
12 | PARAMETER_CURRENT_PAGE = 'current_page' |
|
12 | PARAMETER_CURRENT_PAGE = 'current_page' | |
13 | PARAMETER_PAGINATOR = 'paginator' |
|
13 | PARAMETER_PAGINATOR = 'paginator' | |
14 | PARAMETER_POSTS = 'posts' |
|
14 | PARAMETER_POSTS = 'posts' | |
15 | PARAMETER_ADDITONAL_ATTRS = 'additional_attrs' |
|
|||
16 |
|
15 | |||
17 | PARAMETER_PREV_LINK = 'prev_page_link' |
|
16 | PARAMETER_PREV_LINK = 'prev_page_link' | |
18 | PARAMETER_NEXT_LINK = 'next_page_link' |
|
17 | PARAMETER_NEXT_LINK = 'next_page_link' | |
@@ -26,6 +25,7 b' class FeedView(PostMixin, BaseBoardView)' | |||||
26 | def get(self, request): |
|
25 | def get(self, request): | |
27 | page = request.GET.get('page', DEFAULT_PAGE) |
|
26 | page = request.GET.get('page', DEFAULT_PAGE) | |
28 | tripcode = request.GET.get('tripcode', None) |
|
27 | tripcode = request.GET.get('tripcode', None) | |
|
28 | favorites = 'favorites' in request.GET | |||
29 |
|
29 | |||
30 | params = self.get_context_data(request=request) |
|
30 | params = self.get_context_data(request=request) | |
31 |
|
31 | |||
@@ -36,17 +36,16 b' class FeedView(PostMixin, BaseBoardView)' | |||||
36 | '-pub_time').prefetch_related('images', 'thread', 'threads') |
|
36 | '-pub_time').prefetch_related('images', 'thread', 'threads') | |
37 | if tripcode: |
|
37 | if tripcode: | |
38 | posts = posts.filter(tripcode=tripcode) |
|
38 | posts = posts.filter(tripcode=tripcode) | |
|
39 | if favorites: | |||
|
40 | fav_thread_ops = Post.objects.filter(id__in=settings_manager.get_fav_threads().keys()) | |||
|
41 | fav_threads = [op.get_thread() for op in fav_thread_ops] | |||
|
42 | posts = posts.filter(threads__in=fav_threads) | |||
39 |
|
43 | |||
40 | paginator = get_paginator(posts, POSTS_PER_PAGE) |
|
44 | paginator = get_paginator(posts, POSTS_PER_PAGE) | |
41 | paginator.current_page = int(page) |
|
45 | paginator.current_page = int(page) | |
42 |
|
46 | |||
43 | params[PARAMETER_POSTS] = paginator.page(page).object_list |
|
47 | params[PARAMETER_POSTS] = paginator.page(page).object_list | |
44 |
|
48 | |||
45 | additional_params = dict() |
|
|||
46 | if tripcode: |
|
|||
47 | additional_params['tripcode'] = tripcode |
|
|||
48 | params[PARAMETER_ADDITONAL_ATTRS] = '&tripcode=' + tripcode |
|
|||
49 |
|
||||
50 | paginator.set_url(reverse('feed'), request.GET.dict()) |
|
49 | paginator.set_url(reverse('feed'), request.GET.dict()) | |
51 |
|
50 | |||
52 | self.get_page_context(paginator, params, page) |
|
51 | self.get_page_context(paginator, params, page) |
General Comments 0
You need to be logged in to leave comments.
Login now