diff --git a/akvo/rsr/views/project.py b/akvo/rsr/views/project.py index 489d801473..8d6dfbd811 100644 --- a/akvo/rsr/views/project.py +++ b/akvo/rsr/views/project.py @@ -5,12 +5,24 @@ Akvo RSR module. For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >. """ + from akvo.rsr.models import Project +from akvo.utils import pagination + from django.shortcuts import get_object_or_404, render def directory(request): - context = {'projects': Project.objects.published()} + projects_list = Project.objects.published() + page = request.GET.get('page') + + page, paginator, page_range = pagination(page, projects_list, 10) + + context = { + 'page': page, + 'paginator': paginator, + 'page_range': page_range, + } return render(request, 'project_directory.html', context) diff --git a/akvo/templates/navigation/pagination.html b/akvo/templates/navigation/pagination.html new file mode 100644 index 0000000000..36b0b75927 --- /dev/null +++ b/akvo/templates/navigation/pagination.html @@ -0,0 +1,19 @@ +