Skip to content

Commit 9f43752

Browse files
author
SpaceFox
committed
Hotfix v1.7b - Fixes #2556
2 parents 72db708 + 1d5428f commit 9f43752

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

templates/misc/paginator.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
{% load append_to_get %}
33
{% load i18n %}
44

5-
6-
{% if page_obj|length > 1 %}
5+
{% if paginator.num_pages > 1 %}
76
{% captureas full_anchor %}
87
{% if anchor %}
98
#{{ anchor }}

templates/mp/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
{% endfor %}
8282
</div>
8383

84-
{% include "misc/pagination.part.html" with position='bottom' %}
84+
{% include "misc/paginator.html" with position="bottom" %}
8585
{% endblock %}
8686

8787

zds/mp/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ def get_context_data(self, **kwargs):
263263
context['topic'] = self.object
264264
context['last_post_pk'] = self.object.last_message.pk
265265
context['form'] = PrivatePostForm(self.object)
266-
context['posts'] = self.build_list()
266+
context['posts'] = self.build_list_with_previous_item(context['object_list'])
267267
if never_privateread(self.object):
268268
mark_read(self.object)
269269
return context

zds/utils/paginator.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,20 @@ def get_context_data(self, **kwargs):
4040
context.update(kwargs)
4141
return super(MultipleObjectMixin, self).get_context_data(**context)
4242

43-
def build_list(self):
43+
def build_list_with_previous_item(self, queryset):
4444
"""
4545
For some list paginated, we would like to display the last item of the previous page.
4646
This function returns the list paginated with this previous item.
4747
"""
48+
original_list = queryset.all()
4849
list = []
4950
# If necessary, add the last item in the previous page.
5051
if self.page.number != 1:
5152
last_page = self.paginator.page(self.page.number - 1).object_list
5253
last_item = (last_page)[len(last_page) - 1]
5354
list.append(last_item)
5455
# Adds all items of the list paginated.
55-
for item in self.object_list:
56+
for item in original_list:
5657
list.append(item)
5758
return list
5859

0 commit comments

Comments
 (0)