summaryrefslogtreecommitdiff
path: root/sublab_project/news/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'sublab_project/news/views.py')
-rw-r--r--sublab_project/news/views.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/sublab_project/news/views.py b/sublab_project/news/views.py
index 60f00ef..ff62be5 100644
--- a/sublab_project/news/views.py
+++ b/sublab_project/news/views.py
@@ -1 +1,13 @@
# Create your views here.
+from django.views.generic import ListView
+from django.core.paginator import Paginator
+
+from news.models import News
+
+class NewsListView(ListView):
+ model = News
+ paginate_by = 8
+
+ def get_paginator(self, queryset, per_page, **kwargs):
+ kwargs['orphans'] = 3
+ return Paginator(queryset, per_page, **kwargs)