Skip to content
This repository has been archived by the owner on Jun 29, 2020. It is now read-only.

Commit

Permalink
AnnouncementListViewにページネーター付けた
Browse files Browse the repository at this point in the history
  • Loading branch information
giginet committed Oct 3, 2014
1 parent 8f74966 commit f1f9929
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/kawaz/apps/announcements/tests/test_views.py
Expand Up @@ -3,6 +3,7 @@
from django.test import TestCase
from django.contrib.auth.models import AnonymousUser
from .factories import AnnouncementFactory
from kawaz.apps.announcements.views import AnnouncementListView
from ..models import Announcement
from kawaz.core.personas.tests.factories import PersonaFactory

Expand Down Expand Up @@ -428,3 +429,8 @@ def test_authenticated_can_view_all_publish_announcements(self):
self.assertEqual(list[0], self.announcements[1], 'protected')
self.assertEqual(list[1], self.announcements[0], 'public')

def test_paginate_by(self):
"""
paginator_byが5件にセットされている
"""
self.assertEqual(AnnouncementListView.paginate_by, 5)
1 change: 1 addition & 0 deletions src/kawaz/apps/announcements/views.py
Expand Up @@ -40,6 +40,7 @@ class AnnouncementDetailView(DetailView):
@permission_required('announcements.view_announcement')
class AnnouncementListView(ListView):
model = Announcement
paginate_by = 5

def get_queryset(self):
return Announcement.objects.published(self.request.user)

0 comments on commit f1f9929

Please sign in to comment.