##// END OF EJS Templates
Made feed view use the new-style paginator links
neko259 -
r1378:2ac2fd63 default
parent child Browse files
Show More
@@ -61,7 +61,7 b''
61 {% ifequal page current_page.number %}
61 {% ifequal page current_page.number %}
62 class="current_page"
62 class="current_page"
63 {% endifequal %}
63 {% endifequal %}
64 href="{% url "feed" %}?page={{ page }}{{ additional_attrs }}">{{ page }}</a>
64 href="{% page_url paginator page %}">{{ page }}</a>
65 {% if not forloop.last %},{% endif %}
65 {% if not forloop.last %},{% endif %}
66 {% endfor %}
66 {% endfor %}
67 {% endwith %}
67 {% endwith %}
@@ -47,12 +47,14 b' class FeedView(PostMixin, BaseBoardView)'
47 additional_params['tripcode'] = tripcode
47 additional_params['tripcode'] = tripcode
48 params[PARAMETER_ADDITONAL_ATTRS] = '&tripcode=' + tripcode
48 params[PARAMETER_ADDITONAL_ATTRS] = '&tripcode=' + tripcode
49
49
50 self.get_page_context(paginator, params, page, additional_params)
50 paginator.set_url(reverse('feed'), request.GET.dict())
51
52 self.get_page_context(paginator, params, page)
51
53
52 return render(request, TEMPLATE, params)
54 return render(request, TEMPLATE, params)
53
55
54 # TODO Dedup this into PagedMixin
56 # TODO Dedup this into PagedMixin
55 def get_page_context(self, paginator, params, page, additional_params):
57 def get_page_context(self, paginator, params, page):
56 """
58 """
57 Get pagination context variables
59 Get pagination context variables
58 """
60 """
@@ -61,21 +63,9 b' class FeedView(PostMixin, BaseBoardView)'
61 current_page = paginator.page(int(page))
63 current_page = paginator.page(int(page))
62 params[PARAMETER_CURRENT_PAGE] = current_page
64 params[PARAMETER_CURRENT_PAGE] = current_page
63 if current_page.has_previous():
65 if current_page.has_previous():
64 params[PARAMETER_PREV_LINK] = self.get_previous_page_link(
66 params[PARAMETER_PREV_LINK] = paginator.get_page_url(
65 current_page)
67 current_page.previous_page_number())
66 for param in additional_params.keys():
67 params[PARAMETER_PREV_LINK] += '&{}={}'.format(
68 param, additional_params[param])
69 if current_page.has_next():
68 if current_page.has_next():
70 params[PARAMETER_NEXT_LINK] = self.get_next_page_link(current_page)
69 params[PARAMETER_NEXT_LINK] = paginator.get_page_url(
71 for param in additional_params.keys():
70 current_page.next_page_number())
72 params[PARAMETER_NEXT_LINK] += '&{}={}'.format(
73 param, additional_params[param])
74
71
75 def get_previous_page_link(self, current_page):
76 return reverse('feed') + '?page={}'.format(
77 current_page.previous_page_number())
78
79 def get_next_page_link(self, current_page):
80 return reverse('feed') + '?page={}'.format(
81 current_page.next_page_number())
General Comments 0
You need to be logged in to leave comments. Login now