- edited description
Remove the use of dj-pagination
Issue #134
invalid
Django-postman optionally uses dj-pagination. However, this package is not maintained anymore (since 2021) and does not work with recent Django versions due to the ifequal
template tag (deprecated in 2020).
Nowadays, one can easily create a pagination with a custom tag:
@register.simple_tag(takes_context=True)
def paginate_qs(context, queryset, per_page=10, page_attr="page"):
"""Paginate a queryset and store the pagination in the context."""
paginator = Paginator(queryset, per_page)
page_number = context["request"].GET.get(page_attr, "1")
if re.match(r"^(0|[1-9]\d*)$", page_number):
page = paginator.get_page(int(page_number))
else:
page = paginator.get_page(1)
return page
and add this simple line in the base_folder.html
template:
{% paginate_qs pm_messages per_page=10 as pm_messages_p %}
<tbody>{% for message in pm_messages_p %}
I have also added the following pagination tag, using Django-bootstrap5, at the end of the form:
{% bootstrap_pagination pm_messages_p size='sm' justify_content='center' %}
Comments (3)
-
reporter -
repo owner - changed status to open
A first search leads me to: https://github.com/Polyconseil/dj-pagination/commits/master/
Seems to be a fork, updated to work on py3.12 and dj 5. Let's have a look.
-
repo owner - changed status to invalid
The current maintenance repository is now mentioned in the documentation.
- Log in to comment