Permalink
Browse files

Paginate the list of bookmarks

  • Loading branch information...
norm committed Jul 27, 2015
1 parent 13dfa95 commit 14225bc5a9d1321e6f1fbc212e4ee8266b21899c
Showing with 17 additions and 0 deletions.
  1. +6 −0 apps/bookmarks/views.py
  2. +1 −0 evocation/settings.py
  3. +1 −0 requirements.txt
  4. +9 −0 templates/bookmarks/bookmark_list.html
View
@@ -55,13 +55,15 @@ def post(self, request, *args, **kwargs):
class BookmarkList(ListView):
model = Bookmark
paginate_by = 20
class BookmarkYearList(YearArchiveView):
model = Bookmark
date_field = 'date_added'
make_object_list = True
queryset = Bookmark.objects.all()
paginate_by = 20
class BookmarkMonthList(MonthArchiveView):
@@ -70,6 +72,7 @@ class BookmarkMonthList(MonthArchiveView):
make_object_list = True
queryset = Bookmark.objects.all()
month_format = '%m'
paginate_by = 20
class BookmarkDayList(DayArchiveView):
@@ -78,14 +81,17 @@ class BookmarkDayList(DayArchiveView):
make_object_list = True
queryset = Bookmark.objects.all()
month_format = '%m'
paginate_by = 20
class TagsList(ListView):
model = Tag
paginate_by = 20
class TaggedList(SingleObjectMixin, ListView):
template_name = 'taggit/tagged_list.html'
paginate_by = 20
def get_queryset(self):
self.object = self.get_object(Tag.objects.all())
View
@@ -40,6 +40,7 @@
'apps.bookmarks',
'concertina',
'taggit',
'haystack',
)
View
@@ -7,3 +7,4 @@ git+https://github.com/notanumber/xapian-haystack.git
Pillow==2.9.0
celery==3.1.18
redis==2.10.3
django-concertina==1.0.0
@@ -1,3 +1,12 @@
{% load concertina_pagination %}
<ul>
{% for page in page_obj|concertina_pagination %}
<li><a href='?page={{page}}'>{{page}}</a></li>
{% endfor %}
</ul>
<hr>
{% for bookmark in object_list %}
<li>
<h1><a href='{% url "bookmark-detail" bookmark.pk %}'>{{bookmark}}</a></h1>

0 comments on commit 14225bc

Please sign in to comment.