8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-23 23:43:47 +00:00

pagination

This commit is contained in:
Grizzly 2019-08-06 19:27:03 +00:00 committed by Gabriel Detraz
parent 034dec924d
commit 49184d32d6
2 changed files with 28 additions and 6 deletions

View file

@ -37,7 +37,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<span class="badge badge-light">{{ nbr_tickets }}</span> {% trans "Tickets" %}
</div>
<div class="col-sm-4">
<span class="badge badge-light">{{ nbr_tickets_unsolved }}</span>{% trans "Not Solved Tickets" %}
<span class="badge badge-light"> {{ nbr_tickets_unsolved }}</span>{% trans "Not Solved Tickets" %}
</div>
<div class="col-sm-4">
<span>{% trans "Last Ticket:" %} {{ last_ticket_date }}</span>
@ -46,8 +46,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<hr class="col-sm-12">
</div>
<div class="table-responsiv">
<table class="table">
<table class="table">
<thead>
<tr>
<th scope="col"></th>
@ -76,5 +79,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</thead>
</table>
{% if tickets_list.paginator %}
{% include 'pagination.html' with list=tickets_list go_to_id="tickets" %}
{% endif %}
</div>
{% endblock %}

View file

@ -5,6 +5,11 @@ from django.urls import reverse
from django.forms import modelformset_factory
from re2o.views import form
from re2o.base import (
re2o_paginator,
)
from preferences.models import GeneralOption
from .models import(
Ticket,
Preferences,
@ -56,10 +61,20 @@ def aff_ticket(request,ticketid):
def aff_tickets(request):
""" Vue d'affichage de tout les tickets """
tickets = Ticket.objects.all().order_by('-date')
last_ticket_date = tickets.first().date
nbr_tickets = tickets.count()
nbr_tickets_unsolved = Ticket.objects.filter(solved=False).count()
tickets_list = Ticket.objects.all().order_by('-date')
last_ticket_date = tickets_list.first().date
nbr_tickets = tickets_list.count()
nbr_tickets_unsolved = tickets_list.filter(solved=False).count()
pagination_number = (GeneralOption
.get_cached_value('pagination_number'))
tickets = re2o_paginator(
request,
tickets_list,
pagination_number,
)
context = {'tickets_list':tickets,
'last_ticket_date':last_ticket_date,
'nbr_tickets':nbr_tickets,