From 1e7f6a067501a8ee67c030b0f71bf9041a0ed618 Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Thu, 12 Feb 2015 18:19:40 +0100 Subject: [PATCH] fix geo list pagination --- .../telemeta/geo_country_collections.html | 14 ++++++++++++-- telemeta/templates/telemeta/geo_country_items.html | 13 ++++++++++--- telemeta/views/geo.py | 3 ++- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/telemeta/templates/telemeta/geo_country_collections.html b/telemeta/templates/telemeta/geo_country_collections.html index 85434291..17da117d 100644 --- a/telemeta/templates/telemeta/geo_country_collections.html +++ b/telemeta/templates/telemeta/geo_country_collections.html @@ -5,8 +5,18 @@ {% block head_title %}{{ country }} - {% trans "Geographic Navigator" %} - {{ block.super }}{% endblock %} {% block title %} -geo-country {% trans "World" %} / - {{ continent }} / {{ country }} + +
+
+ geo-country {% trans "World" %} / + {{ continent }} / {{ country }} ({{ page_obj.start_index }} - {{ page_obj.end_index }} / {{ count }}) +
+
+{% bootstrap_paginate page_obj range=10 show_first_last="True" %} +
+
 
+
+ {% endblock title %} {% block content %} diff --git a/telemeta/templates/telemeta/geo_country_items.html b/telemeta/templates/telemeta/geo_country_items.html index ffd1469c..252c5118 100644 --- a/telemeta/templates/telemeta/geo_country_items.html +++ b/telemeta/templates/telemeta/geo_country_items.html @@ -5,9 +5,16 @@ {% block head_title %}{{ country }} - {% trans "Geographic Navigator" %} - {{ block.super }}{% endblock %} {% block title %} -{% trans "World" %} / - {{ continent }} - / {{ country }} +
+
+ geo-country {% trans "World" %} / + {{ continent }} / {{ country }} ({{ page_obj.start_index }} - {{ page_obj.end_index }} / {{ count }}) +
+
+{% bootstrap_paginate page_obj range=10 show_first_last="True" %} +
+
 
+
{% endblock title %} {% block content %} diff --git a/telemeta/views/geo.py b/telemeta/views/geo.py index c7f00edb..29ddaf53 100644 --- a/telemeta/views/geo.py +++ b/telemeta/views/geo.py @@ -94,10 +94,10 @@ class GeoCountryCollectionView(ListView): context = super(GeoCountryCollectionView, self).get_context_data(*args, **kwargs) context['country'] = self.country context['continent'] = self.continent + context['count'] = self.object_list.count() return context - class GeoCountryItemView(ListView): model = MediaItem @@ -115,6 +115,7 @@ class GeoCountryItemView(ListView): context = super(GeoCountryItemView, self).get_context_data(*args, **kwargs) context['country'] = self.country context['continent'] = self.continent + context['count'] = self.object_list.count() return context -- 2.39.5