Commit c9101d25 authored by Nicolas Joyard's avatar Nicolas Joyard
Browse files

Add pagination and active filter to group views

parent 2ca64493
......@@ -2,16 +2,21 @@
import datetime
from core.views import PaginationMixin, ActiveLegislatureMixin
from django.db import models
from django.views import generic
from representatives.models import Group
class GroupList(generic.ListView):
class GroupList(PaginationMixin, ActiveLegislatureMixin, generic.ListView):
def get_queryset(self):
qs = Group.objects.filter(
qs = Group.objects.all()
if self.get_active_only():
qs = qs.filter(
models.Q(mandates__end_date__gte=datetime.date.today()) |
models.Q(mandates__end_date__isnull=True)
)
......
......@@ -3,8 +3,12 @@
- load memopol_tags
- load representatives_tags
- block content
- include 'core/blocks/pagination.html'
- block list
%table.table
- for group in object_list
%tr
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment