mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-22 11:23:10 +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,
|
Room,
|
||||||
Stack,
|
Stack,
|
||||||
ModelSwitch,
|
ModelSwitch,
|
||||||
ConstructorSwitch
|
ConstructorSwitch,
|
||||||
|
AccessPoint
|
||||||
)
|
)
|
||||||
from preferences.models import GeneralOption
|
from preferences.models import GeneralOption
|
||||||
from re2o.views import form
|
from re2o.views import form
|
||||||
|
@ -360,6 +361,7 @@ def stats_models(request):
|
||||||
},
|
},
|
||||||
'Topologie': {
|
'Topologie': {
|
||||||
'switch': [Switch.PRETTY_NAME, Switch.objects.count()],
|
'switch': [Switch.PRETTY_NAME, Switch.objects.count()],
|
||||||
|
'bornes': [AccessPoint.PRETTY_NAME, AccessPoint.objects.count()],
|
||||||
'port': [Port.PRETTY_NAME, Port.objects.count()],
|
'port': [Port.PRETTY_NAME, Port.objects.count()],
|
||||||
'chambre': [Room.PRETTY_NAME, Room.objects.count()],
|
'chambre': [Room.PRETTY_NAME, Room.objects.count()],
|
||||||
'stack': [Stack.PRETTY_NAME, Stack.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 %}
|
{% load acl %}
|
||||||
|
|
||||||
|
<div class="table-responsive">
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -55,4 +56,4 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
</div>
|
||||||
|
|
|
@ -23,15 +23,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
|
|
||||||
{% load acl %}
|
{% load acl %}
|
||||||
|
<div class="table-responsive">
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Type d'ip</th>
|
<th>Type d'ip</th>
|
||||||
<th>Extension</th>
|
<th>Extension</th>
|
||||||
<th>Nécessite l'autorisation infra</th>
|
<th>Nécessite l'autorisation infra</th>
|
||||||
<th>Début</th>
|
<th>Plage ipv4</th>
|
||||||
<th>Fin</th>
|
|
||||||
<th>Préfixe v6</th>
|
<th>Préfixe v6</th>
|
||||||
<th>Sur vlan</th>
|
<th>Sur vlan</th>
|
||||||
<th>Ouverture ports par défault</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.type }}</td>
|
||||||
<td>{{ type.extension }}</td>
|
<td>{{ type.extension }}</td>
|
||||||
<td>{{ type.need_infra }}</td>
|
<td>{{ type.need_infra }}</td>
|
||||||
<td>{{ type.domaine_ip_start }}</td>
|
<td>{{ type.domaine_ip_start }}-{{ type.domaine_ip_stop }}</td>
|
||||||
<td>{{ type.domaine_ip_stop }}</td>
|
|
||||||
<td>{{ type.prefix_v6 }}</td>
|
<td>{{ type.prefix_v6 }}</td>
|
||||||
<td>{{ type.vlan }}</td>
|
<td>{{ type.vlan }}</td>
|
||||||
<td>{{ type.ouverture_ports }}</td>
|
<td>{{ type.ouverture_ports }}</td>
|
||||||
|
@ -58,4 +56,4 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
</div>
|
||||||
|
|
|
@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
|
||||||
{% load acl %}
|
{% load acl %}
|
||||||
|
|
||||||
|
<div class="table-responsive">
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -49,4 +50,4 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
</div>
|
||||||
|
|
|
@ -190,6 +190,10 @@ class SortTable:
|
||||||
'white_end': ['date_end'],
|
'white_end': ['date_end'],
|
||||||
'default': ['-date_end']
|
'default': ['-date_end']
|
||||||
}
|
}
|
||||||
|
USERS_INDEX_SCHOOL = {
|
||||||
|
'school_name': ['name'],
|
||||||
|
'default': ['name']
|
||||||
|
}
|
||||||
MACHINES_INDEX = {
|
MACHINES_INDEX = {
|
||||||
'machine_name': ['name'],
|
'machine_name': ['name'],
|
||||||
'default': ['pk']
|
'default': ['pk']
|
||||||
|
|
|
@ -47,7 +47,7 @@ from django.db import IntegrityError
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
from reversion import revisions as reversion
|
from reversion import revisions as reversion
|
||||||
|
|
||||||
from machines.models import Machine, Interface
|
from machines.models import Machine, Interface, regen
|
||||||
|
|
||||||
class Stack(models.Model):
|
class Stack(models.Model):
|
||||||
"""Un objet stack. Regrouppe des switchs en foreign key
|
"""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.
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
{% load acl %}
|
{% load acl %}
|
||||||
|
|
||||||
|
<div class="table-responsive">
|
||||||
|
|
||||||
|
{% if school_list.paginator %}
|
||||||
|
{% include "pagination.html" with list=school_list %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Etablissement</th>
|
<th>{% include "buttons/sort.html" with prefix='school' col='name' text='Etablissement' %}</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
@ -42,3 +50,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</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>
|
<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 %}
|
{% 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>
|
<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 %}
|
{% include "users/aff_schools.html" with school_list=school_list %}
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
|
|
|
@ -747,6 +747,23 @@ def index_white(request):
|
||||||
def index_school(request):
|
def index_school(request):
|
||||||
""" Affiche l'ensemble des établissement"""
|
""" Affiche l'ensemble des établissement"""
|
||||||
school_list = School.objects.order_by('name')
|
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(
|
return render(
|
||||||
request,
|
request,
|
||||||
'users/index_schools.html',
|
'users/index_schools.html',
|
||||||
|
|
Loading…
Reference in a new issue