diff --git a/apis_core/apis_metainfo/templates/generic_list.html b/apis_core/apis_metainfo/templates/generic_list.html index 89cc3a2e0..9f23813d1 100644 --- a/apis_core/apis_metainfo/templates/generic_list.html +++ b/apis_core/apis_metainfo/templates/generic_list.html @@ -5,6 +5,7 @@ {% load i18n %} {% load crispy_forms_field %} {% load crispy_forms_tags %} +{% load apiscore %} {% block title %}Browse {{ class_name }}{% endblock %} @@ -255,103 +256,50 @@

{{ data.title }}

{% block pagination.allpages %} -
- {% with table.page.object_list|length as count %}

Page total: {{ count }}

{% endwith %} -
- -
- - -
- {% else %} - - {% if table.page.has_previous %} - - {% block pagination.previous %} - - {% endblock pagination.previous %} - + {{table.page.object_list|length}} results per page + + - {% endblock pagination.allpages %} + + {% if table.paginator.page_range|length > 10 %} +
+ + +
+ {% endif %} + {% endblock pagination.allpages %} diff --git a/apis_core/core/templatetags/apiscore.py b/apis_core/core/templatetags/apiscore.py index a171d68a5..e001c1a30 100644 --- a/apis_core/core/templatetags/apiscore.py +++ b/apis_core/core/templatetags/apiscore.py @@ -8,3 +8,8 @@ @register.simple_tag def shared_url(): return getattr(settings, "SHARED_URL", "/static/") + + +@register.simple_tag +def page_range(paginator, number): + return paginator.get_elided_page_range(number=number)