mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-22 03:13:12 +00:00
Paginateur sur school + tableaux responsives + fix divers
This commit is contained in:
parent
06d4b42716
commit
2966547b19
9 changed files with 49 additions and 12 deletions
|
@ -90,7 +90,8 @@ from topologie.models import (
|
|||
Room,
|
||||
Stack,
|
||||
ModelSwitch,
|
||||
ConstructorSwitch
|
||||
ConstructorSwitch,
|
||||
AccessPoint
|
||||
)
|
||||
from preferences.models import GeneralOption
|
||||
from re2o.views import form
|
||||
|
@ -360,6 +361,7 @@ def stats_models(request):
|
|||
},
|
||||
'Topologie': {
|
||||
'switch': [Switch.PRETTY_NAME, Switch.objects.count()],
|
||||
'bornes': [AccessPoint.PRETTY_NAME, AccessPoint.objects.count()],
|
||||
'port': [Port.PRETTY_NAME, Port.objects.count()],
|
||||
'chambre': [Room.PRETTY_NAME, Room.objects.count()],
|
||||
'stack': [Stack.PRETTY_NAME, Stack.objects.count()],
|
||||
|
|
|
@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
|
||||
{% load acl %}
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -38,7 +39,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
</tr>
|
||||
</thead>
|
||||
{% for extension in extension_list %}
|
||||
<tr>
|
||||
<tr>
|
||||
<td>{{ extension.name }}</td>
|
||||
<td>{{ extension.need_infra }}</td>
|
||||
<td>{{ extension.soa}}</td>
|
||||
|
@ -55,4 +56,4 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -23,15 +23,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% endcomment %}
|
||||
|
||||
{% load acl %}
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Type d'ip</th>
|
||||
<th>Extension</th>
|
||||
<th>Nécessite l'autorisation infra</th>
|
||||
<th>Début</th>
|
||||
<th>Fin</th>
|
||||
<th>Plage ipv4</th>
|
||||
<th>Préfixe v6</th>
|
||||
<th>Sur vlan</th>
|
||||
<th>Ouverture ports par défault</th>
|
||||
|
@ -44,8 +43,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
<td>{{ type.type }}</td>
|
||||
<td>{{ type.extension }}</td>
|
||||
<td>{{ type.need_infra }}</td>
|
||||
<td>{{ type.domaine_ip_start }}</td>
|
||||
<td>{{ type.domaine_ip_stop }}</td>
|
||||
<td>{{ type.domaine_ip_start }}-{{ type.domaine_ip_stop }}</td>
|
||||
<td>{{ type.prefix_v6 }}</td>
|
||||
<td>{{ type.vlan }}</td>
|
||||
<td>{{ type.ouverture_ports }}</td>
|
||||
|
@ -58,4 +56,4 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
|
||||
{% load acl %}
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -49,4 +50,4 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -190,6 +190,10 @@ class SortTable:
|
|||
'white_end': ['date_end'],
|
||||
'default': ['-date_end']
|
||||
}
|
||||
USERS_INDEX_SCHOOL = {
|
||||
'school_name': ['name'],
|
||||
'default': ['name']
|
||||
}
|
||||
MACHINES_INDEX = {
|
||||
'machine_name': ['name'],
|
||||
'default': ['pk']
|
||||
|
|
|
@ -47,7 +47,7 @@ from django.db import IntegrityError
|
|||
from django.db import transaction
|
||||
from reversion import revisions as reversion
|
||||
|
||||
from machines.models import Machine, Interface
|
||||
from machines.models import Machine, Interface, regen
|
||||
|
||||
class Stack(models.Model):
|
||||
"""Un objet stack. Regrouppe des switchs en foreign key
|
||||
|
|
|
@ -22,10 +22,18 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
{% endcomment %}
|
||||
{% load acl %}
|
||||
|
||||
<div class="table-responsive">
|
||||
|
||||
{% if school_list.paginator %}
|
||||
{% include "pagination.html" with list=school_list %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Etablissement</th>
|
||||
<th>{% include "buttons/sort.html" with prefix='school' col='name' text='Etablissement' %}</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -42,3 +50,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% endfor %}
|
||||
</table>
|
||||
|
||||
{% if school_list.paginator %}
|
||||
{% include "pagination.html" with list=school_list %}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:add-school' %}"><i class="fa fa-plus"></i> Ajouter un établissement</a>
|
||||
{% acl_end %}
|
||||
<a class="btn btn-danger btn-sm" role="button" href="{% url 'users:del-school' %}"><i class="fa fa-trash"></i> Supprimer un ou plusieurs établissements</a>
|
||||
<hr>
|
||||
{% include "users/aff_schools.html" with school_list=school_list %}
|
||||
<br />
|
||||
<br />
|
||||
|
|
|
@ -747,6 +747,23 @@ def index_white(request):
|
|||
def index_school(request):
|
||||
""" Affiche l'ensemble des établissement"""
|
||||
school_list = School.objects.order_by('name')
|
||||
pagination_number = GeneralOption.get_cached_value('pagination_number')
|
||||
school_list = SortTable.sort(
|
||||
school_list,
|
||||
request.GET.get('col'),
|
||||
request.GET.get('order'),
|
||||
SortTable.USERS_INDEX_SCHOOL
|
||||
)
|
||||
paginator = Paginator(school_list, pagination_number)
|
||||
page = request.GET.get('page')
|
||||
try:
|
||||
school_list = paginator.page(page)
|
||||
except PageNotAnInteger:
|
||||
# If page isn't an integer, deliver first page
|
||||
school_list = paginator.page(1)
|
||||
except EmptyPage:
|
||||
# If page is out of range (e.g. 9999), deliver last page of results.
|
||||
school_list = paginator.page(paginator.num_pages)
|
||||
return render(
|
||||
request,
|
||||
'users/index_schools.html',
|
||||
|
|
Loading…
Reference in a new issue