Skip to content
This repository has been archived by the owner on Oct 5, 2021. It is now read-only.

Commit

Permalink
put 'paginate_by' in the settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Olivier Demah committed Jun 20, 2015
1 parent b3c9efd commit ac98ea6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion django_th/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,18 @@ class TriggerListView(ListView):
context_object_name = "triggers_list"
queryset = TriggerService.objects.all()
template_name = "home.html"
paginate_by = 3

def get_paginate_by(self, queryset):
"""
Get the number of items to paginate by,
from the settings
"""
return settings.DJANGO_TH['paginate_by']
paginate_by = 3
if hasattr(settings, 'DJANGO_TH'):
if 'paginate_by' in settings.DJANGO_TH:
paginate_by = settings.DJANGO_TH['paginate_by']
return paginate_by

def get_queryset(self):
filtered_by = None
Expand Down

0 comments on commit ac98ea6

Please sign in to comment.