mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-05 01:16:27 +00:00
Ajoute les sorts sur les bans et les whitelists
This commit is contained in:
parent
95ad603ab5
commit
46e1b784d6
5 changed files with 45 additions and 21 deletions
|
@ -151,11 +151,25 @@ class SortTable:
|
|||
# to use as order field in the request. A 'default' might be provided to
|
||||
# specify what to do if the requested col doesn't match any keys.
|
||||
USERS_INDEX = {
|
||||
'prenom' : 'name',
|
||||
'nom' : 'surname',
|
||||
'pseudo' : 'pseudo',
|
||||
'chamber' : 'room',
|
||||
'default' : 'pseudo'
|
||||
'name': 'name',
|
||||
'surname': 'surname',
|
||||
'pseudo': 'pseudo',
|
||||
'room': 'room',
|
||||
'default': 'pseudo'
|
||||
}
|
||||
USERS_INDEX_BAN = {
|
||||
'user': 'user__pseudo',
|
||||
'reason': 'raison',
|
||||
'start': 'date_start',
|
||||
'end': 'date_end',
|
||||
'default': 'date_end'
|
||||
}
|
||||
USERS_INDEX_WHITE = {
|
||||
'user': 'user__pseudo',
|
||||
'reason': 'raison',
|
||||
'start': 'date_start',
|
||||
'end': 'date_end',
|
||||
'default': 'date_end'
|
||||
}
|
||||
|
||||
@staticmethod
|
||||
|
|
|
@ -29,10 +29,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Utilisateur</th>
|
||||
<th>Raison</th>
|
||||
<th>Date de début</th>
|
||||
<th>Date de fin</th>
|
||||
<th>{% include "buttons/sort.html" with col="user" text="Utilisateur" %}</th>
|
||||
<th>{% include "buttons/sort.html" with col="reason" text="Raison" %}</th>
|
||||
<th>{% include "buttons/sort.html" with col="start" text="Date de début" %}</th>
|
||||
<th>{% include "buttons/sort.html" with col="end" text="Date de fin" %}</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
|
|
@ -29,10 +29,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{% include "buttons/sort.html" with col="prenom" text="Prénom" %}</th>
|
||||
<th>Nom</th>
|
||||
<th>Pseudo</th>
|
||||
<th>Chambre</th>
|
||||
<th>{% include "buttons/sort.html" with col="name" text="Prénom" %}</th>
|
||||
<th>{% include "buttons/sort.html" with col="surname" text="Nom" %}</th>
|
||||
<th>{% include "buttons/sort.html" with col="pseudo" text="Pseudo" %}</th>
|
||||
<th>{% include "buttons/sort.html" with col="room" text="Chambre" %}</th>
|
||||
<th>Fin de cotisation le</th>
|
||||
<th>Connexion</th>
|
||||
<th>Profil</th>
|
||||
|
|
|
@ -29,10 +29,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Utilisateur</th>
|
||||
<th>Raison</th>
|
||||
<th>Date de début</th>
|
||||
<th>Date de fin</th>
|
||||
<th>{% include "buttons/sort.html" with col="user" text="Utilisateur" %}</th>
|
||||
<th>{% include "buttons/sort.html" with col="reason" text="Raison" %}</th>
|
||||
<th>{% include "buttons/sort.html" with col="start" text="Date de début" %}</th>
|
||||
<th>{% include "buttons/sort.html" with col="end" text="Date de fin" %}</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
|
|
@ -601,8 +601,13 @@ def index_ban(request):
|
|||
""" Affiche l'ensemble des ban, need droit cableur """
|
||||
options, _created = GeneralOption.objects.get_or_create()
|
||||
pagination_number = options.pagination_number
|
||||
ban_list = Ban.objects.order_by('date_start')\
|
||||
.select_related('user').reverse()
|
||||
ban_list = Ban.objects.select_related('user')
|
||||
ban_list = SortTable.sort(
|
||||
ban_list,
|
||||
request.GET.get('col'),
|
||||
request.GET.get('order'),
|
||||
SortTable.USERS_INDEX_BAN
|
||||
)
|
||||
paginator = Paginator(ban_list, pagination_number)
|
||||
page = request.GET.get('page')
|
||||
try:
|
||||
|
@ -622,8 +627,13 @@ def index_white(request):
|
|||
""" Affiche l'ensemble des whitelist, need droit cableur """
|
||||
options, _created = GeneralOption.objects.get_or_create()
|
||||
pagination_number = options.pagination_number
|
||||
white_list = Whitelist.objects.select_related('user')\
|
||||
.order_by('date_start')
|
||||
white_list = Whitelist.objects.select_related('user')
|
||||
white_list = SortTable.sort(
|
||||
white_list,
|
||||
request.GET.get('col'),
|
||||
request.GET.get('order'),
|
||||
SortTable.USERS_INDEX_BAN
|
||||
)
|
||||
paginator = Paginator(white_list, pagination_number)
|
||||
page = request.GET.get('page')
|
||||
try:
|
||||
|
|
Loading…
Reference in a new issue