- return render(request, 'note_list.html', {'notes': notes, 'notes_count': notes_count})
+ paginator = Paginator(notes, NOTES_PER_PAGE)
+
+ page_number = 1
+
+ try:
+ page_number = int(request.GET.get('page'))
+ except:
+ pass
+
+ notes_page = paginator.get_page(page_number)
+
+ return render(request, 'note_list.html', {'notes_page': notes_page, 'notes_count': notes_count, 'pages': paginator, 'page_number': page_number})