mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-23 11:53:12 +00:00
pagination
This commit is contained in:
parent
034dec924d
commit
49184d32d6
2 changed files with 28 additions and 6 deletions
|
@ -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" %}
|
<span class="badge badge-light">{{ nbr_tickets }}</span> {% trans "Tickets" %}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-4">
|
<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>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
<span>{% trans "Last Ticket:" %} {{ last_ticket_date }}</span>
|
<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">
|
<hr class="col-sm-12">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="table-responsiv">
|
<div class="table-responsiv">
|
||||||
<table class="table">
|
|
||||||
|
<table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col"></th>
|
<th scope="col"></th>
|
||||||
|
@ -76,5 +79,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
|
||||||
</thead>
|
</thead>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
{% if tickets_list.paginator %}
|
||||||
|
{% include 'pagination.html' with list=tickets_list go_to_id="tickets" %}
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -5,6 +5,11 @@ from django.urls import reverse
|
||||||
from django.forms import modelformset_factory
|
from django.forms import modelformset_factory
|
||||||
from re2o.views import form
|
from re2o.views import form
|
||||||
|
|
||||||
|
from re2o.base import (
|
||||||
|
re2o_paginator,
|
||||||
|
)
|
||||||
|
|
||||||
|
from preferences.models import GeneralOption
|
||||||
from .models import(
|
from .models import(
|
||||||
Ticket,
|
Ticket,
|
||||||
Preferences,
|
Preferences,
|
||||||
|
@ -56,10 +61,20 @@ def aff_ticket(request,ticketid):
|
||||||
|
|
||||||
def aff_tickets(request):
|
def aff_tickets(request):
|
||||||
""" Vue d'affichage de tout les tickets """
|
""" Vue d'affichage de tout les tickets """
|
||||||
tickets = Ticket.objects.all().order_by('-date')
|
tickets_list = Ticket.objects.all().order_by('-date')
|
||||||
last_ticket_date = tickets.first().date
|
last_ticket_date = tickets_list.first().date
|
||||||
nbr_tickets = tickets.count()
|
nbr_tickets = tickets_list.count()
|
||||||
nbr_tickets_unsolved = Ticket.objects.filter(solved=False).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,
|
context = {'tickets_list':tickets,
|
||||||
'last_ticket_date':last_ticket_date,
|
'last_ticket_date':last_ticket_date,
|
||||||
'nbr_tickets':nbr_tickets,
|
'nbr_tickets':nbr_tickets,
|
||||||
|
|
Loading…
Reference in a new issue