mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-23 11:53:12 +00:00
Merge branch 'update_crans' into 'master'
Update crans See merge request nounous/re2o!23
This commit is contained in:
commit
f5de618078
12 changed files with 154 additions and 318 deletions
|
@ -28,7 +28,6 @@ import os
|
||||||
|
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.shortcuts import render, redirect
|
from django.shortcuts import render, redirect
|
||||||
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
|
|
||||||
from django.core.validators import MaxValueValidator
|
from django.core.validators import MaxValueValidator
|
||||||
from django.contrib.auth.decorators import login_required, permission_required
|
from django.contrib.auth.decorators import login_required, permission_required
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
|
@ -45,7 +44,7 @@ from users.models import User
|
||||||
from re2o.settings import LOGO_PATH
|
from re2o.settings import LOGO_PATH
|
||||||
from re2o import settings
|
from re2o import settings
|
||||||
from re2o.views import form
|
from re2o.views import form
|
||||||
from re2o.utils import SortTable
|
from re2o.utils import SortTable, re2o_paginator
|
||||||
from re2o.acl import (
|
from re2o.acl import (
|
||||||
can_create,
|
can_create,
|
||||||
can_edit,
|
can_edit,
|
||||||
|
@ -455,14 +454,7 @@ def control(request):
|
||||||
fields=('control', 'valid'),
|
fields=('control', 'valid'),
|
||||||
extra=0
|
extra=0
|
||||||
)
|
)
|
||||||
paginator = Paginator(facture_list, pagination_number)
|
facture_list = re2o_paginator(request, facture_list, pagination_number)
|
||||||
page = request.GET.get('page')
|
|
||||||
try:
|
|
||||||
facture_list = paginator.page(page)
|
|
||||||
except PageNotAnInteger:
|
|
||||||
facture_list = paginator.page(1)
|
|
||||||
except EmptyPage:
|
|
||||||
facture_list = paginator.page(paginator.num.pages)
|
|
||||||
controlform = controlform_set(request.POST or None, queryset=facture_list.object_list)
|
controlform = controlform_set(request.POST or None, queryset=facture_list.object_list)
|
||||||
if controlform.is_valid():
|
if controlform.is_valid():
|
||||||
controlform.save()
|
controlform.save()
|
||||||
|
@ -517,16 +509,7 @@ def index(request):
|
||||||
request.GET.get('order'),
|
request.GET.get('order'),
|
||||||
SortTable.COTISATIONS_INDEX
|
SortTable.COTISATIONS_INDEX
|
||||||
)
|
)
|
||||||
paginator = Paginator(facture_list, pagination_number)
|
facture_list = re2o_paginator(request, facture_list, pagination_number)
|
||||||
page = request.GET.get('page')
|
|
||||||
try:
|
|
||||||
facture_list = paginator.page(page)
|
|
||||||
except PageNotAnInteger:
|
|
||||||
# If page is not an integer, deliver first page.
|
|
||||||
facture_list = paginator.page(1)
|
|
||||||
except EmptyPage:
|
|
||||||
# If page is out of range (e.g. 9999), deliver last page of results.
|
|
||||||
facture_list = paginator.page(paginator.num_pages)
|
|
||||||
return render(request, 'cotisations/index.html', {
|
return render(request, 'cotisations/index.html', {
|
||||||
'facture_list': facture_list
|
'facture_list': facture_list
|
||||||
})
|
})
|
||||||
|
|
|
@ -237,7 +237,7 @@ def detach(_=None):
|
||||||
return radiusd.RLM_MODULE_OK
|
return radiusd.RLM_MODULE_OK
|
||||||
|
|
||||||
def find_nas_from_request(nas_id):
|
def find_nas_from_request(nas_id):
|
||||||
nas = Interface.objects.filter(Q(domain=Domain.objects.filter(name=nas_id)) | Q(ipv4=IpList.objects.filter(ipv4=nas_id))).select_related('type').select_related('switch__stack')
|
nas = Interface.objects.filter(Q(domain=Domain.objects.filter(name=nas_id)) | Q(ipv4=IpList.objects.filter(ipv4=nas_id))).select_related('type').select_related('machine__switch__stack')
|
||||||
return nas.first()
|
return nas.first()
|
||||||
|
|
||||||
def check_user_machine_and_register(nas_type, username, mac_address):
|
def check_user_machine_and_register(nas_type, username, mac_address):
|
||||||
|
|
|
@ -39,7 +39,6 @@ from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.shortcuts import render, redirect
|
from django.shortcuts import render, redirect
|
||||||
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
|
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
from django.db.models import Count, Max
|
from django.db.models import Count, Max
|
||||||
|
@ -100,6 +99,7 @@ from re2o.utils import (
|
||||||
all_baned,
|
all_baned,
|
||||||
all_has_access,
|
all_has_access,
|
||||||
all_adherent,
|
all_adherent,
|
||||||
|
re2o_paginator,
|
||||||
)
|
)
|
||||||
from re2o.acl import (
|
from re2o.acl import (
|
||||||
can_view_all,
|
can_view_all,
|
||||||
|
@ -139,17 +139,7 @@ def index(request):
|
||||||
request.GET.get('order'),
|
request.GET.get('order'),
|
||||||
SortTable.LOGS_INDEX
|
SortTable.LOGS_INDEX
|
||||||
)
|
)
|
||||||
paginator = Paginator(versions, pagination_number)
|
versions = re2o_paginator(request, versions, pagination_number)
|
||||||
page = request.GET.get('page')
|
|
||||||
try:
|
|
||||||
versions = paginator.page(page)
|
|
||||||
except PageNotAnInteger:
|
|
||||||
# If page is not an integer, deliver first page.
|
|
||||||
versions = paginator.page(1)
|
|
||||||
except EmptyPage:
|
|
||||||
# If page is out of range (e.g. 9999), deliver last page of results.
|
|
||||||
versions = paginator.page(paginator.num_pages)
|
|
||||||
|
|
||||||
# Force to have a list instead of QuerySet
|
# Force to have a list instead of QuerySet
|
||||||
versions.count(0)
|
versions.count(0)
|
||||||
# Items to remove later because invalid
|
# Items to remove later because invalid
|
||||||
|
@ -191,16 +181,7 @@ def stats_logs(request):
|
||||||
request.GET.get('order'),
|
request.GET.get('order'),
|
||||||
SortTable.LOGS_STATS_LOGS
|
SortTable.LOGS_STATS_LOGS
|
||||||
)
|
)
|
||||||
paginator = Paginator(revisions, pagination_number)
|
revisions = re2o_paginator(request, revisions, pagination_number)
|
||||||
page = request.GET.get('page')
|
|
||||||
try:
|
|
||||||
revisions = paginator.page(page)
|
|
||||||
except PageNotAnInteger:
|
|
||||||
# If page is not an integer, deliver first page.
|
|
||||||
revisions = paginator.page(1)
|
|
||||||
except EmptyPage:
|
|
||||||
# If page is out of range (e.g. 9999), deliver last page of results.
|
|
||||||
revisions = paginator.page(paginator.num_pages)
|
|
||||||
return render(request, 'logs/stats_logs.html', {
|
return render(request, 'logs/stats_logs.html', {
|
||||||
'revisions_list': revisions
|
'revisions_list': revisions
|
||||||
})
|
})
|
||||||
|
|
|
@ -33,7 +33,6 @@ from django.http import HttpResponse
|
||||||
from django.shortcuts import render, redirect
|
from django.shortcuts import render, redirect
|
||||||
from django.shortcuts import get_object_or_404
|
from django.shortcuts import get_object_or_404
|
||||||
from django.template.context_processors import csrf
|
from django.template.context_processors import csrf
|
||||||
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
|
|
||||||
from django.template import Context, RequestContext, loader
|
from django.template import Context, RequestContext, loader
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.contrib.auth.decorators import login_required, permission_required
|
from django.contrib.auth.decorators import login_required, permission_required
|
||||||
|
@ -123,6 +122,7 @@ from re2o.utils import (
|
||||||
all_has_access,
|
all_has_access,
|
||||||
filter_active_interfaces,
|
filter_active_interfaces,
|
||||||
SortTable,
|
SortTable,
|
||||||
|
re2o_paginator,
|
||||||
)
|
)
|
||||||
from re2o.acl import (
|
from re2o.acl import (
|
||||||
can_create,
|
can_create,
|
||||||
|
@ -863,16 +863,7 @@ def index(request):
|
||||||
request.GET.get('order'),
|
request.GET.get('order'),
|
||||||
SortTable.MACHINES_INDEX
|
SortTable.MACHINES_INDEX
|
||||||
)
|
)
|
||||||
paginator = Paginator(machines_list, pagination_large_number)
|
machines_list = re2o_paginator(request, machines_list, pagination_large_number)
|
||||||
page = request.GET.get('page')
|
|
||||||
try:
|
|
||||||
machines_list = paginator.page(page)
|
|
||||||
except PageNotAnInteger:
|
|
||||||
# If page is not an integer, deliver first page.
|
|
||||||
machines_list = paginator.page(1)
|
|
||||||
except EmptyPage:
|
|
||||||
# If page is out of range (e.g. 9999), deliver last page of results.
|
|
||||||
machines_list = paginator.page(paginator.num_pages)
|
|
||||||
return render(request, 'machines/index.html', {'machines_list': machines_list})
|
return render(request, 'machines/index.html', {'machines_list': machines_list})
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
|
|
|
@ -32,7 +32,6 @@ from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.shortcuts import render, redirect
|
from django.shortcuts import render, redirect
|
||||||
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
|
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.contrib.auth.decorators import login_required, permission_required
|
from django.contrib.auth.decorators import login_required, permission_required
|
||||||
from django.db.models import ProtectedError
|
from django.db.models import ProtectedError
|
||||||
|
|
|
@ -42,6 +42,7 @@ from django.db.models import Q
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.shortcuts import redirect
|
from django.shortcuts import redirect
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
|
||||||
|
|
||||||
from cotisations.models import Cotisation, Facture, Paiement, Vente
|
from cotisations.models import Cotisation, Facture, Paiement, Vente
|
||||||
from machines.models import Domain, Interface, Machine
|
from machines.models import Domain, Interface, Machine
|
||||||
|
@ -280,6 +281,22 @@ class SortTable:
|
||||||
else:
|
else:
|
||||||
return request
|
return request
|
||||||
|
|
||||||
|
def re2o_paginator(request, query_set, pagination_number):
|
||||||
|
"""Paginator script for list display in re2o.
|
||||||
|
:request:
|
||||||
|
:query_set: Query_set to paginate
|
||||||
|
:pagination_number: Number of entries to display"""
|
||||||
|
paginator = Paginator(query_set, pagination_number)
|
||||||
|
page = request.GET.get('page')
|
||||||
|
try:
|
||||||
|
results = paginator.page(page)
|
||||||
|
except PageNotAnInteger:
|
||||||
|
# If page is not an integer, deliver first page.
|
||||||
|
results = paginator.page(1)
|
||||||
|
except EmptyPage:
|
||||||
|
# If page is out of range (e.g. 9999), deliver last page of results.
|
||||||
|
results = paginator.page(paginator.num_pages)
|
||||||
|
return results
|
||||||
|
|
||||||
def remove_user_room(room):
|
def remove_user_room(room):
|
||||||
""" Déménage de force l'ancien locataire de la chambre """
|
""" Déménage de force l'ancien locataire de la chambre """
|
||||||
|
|
|
@ -31,7 +31,6 @@ from django.urls import reverse
|
||||||
from django.shortcuts import render, redirect
|
from django.shortcuts import render, redirect
|
||||||
from django.template.context_processors import csrf
|
from django.template.context_processors import csrf
|
||||||
from django.contrib.auth.decorators import login_required, permission_required
|
from django.contrib.auth.decorators import login_required, permission_required
|
||||||
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
|
|
||||||
from reversion.models import Version
|
from reversion.models import Version
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from preferences.models import Service
|
from preferences.models import Service
|
||||||
|
@ -42,6 +41,7 @@ import os
|
||||||
import time
|
import time
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
import users, preferences, cotisations, topologie, machines
|
import users, preferences, cotisations, topologie, machines
|
||||||
|
from .utils import re2o_paginator
|
||||||
|
|
||||||
def form(ctx, template, request):
|
def form(ctx, template, request):
|
||||||
"""Form générique, raccourci importé par les fonctions views du site"""
|
"""Form générique, raccourci importé par les fonctions views du site"""
|
||||||
|
@ -150,16 +150,7 @@ def history(request, application, object_name, object_id):
|
||||||
if hasattr(instance, 'linked_objects'):
|
if hasattr(instance, 'linked_objects'):
|
||||||
for related_object in chain(instance.linked_objects()):
|
for related_object in chain(instance.linked_objects()):
|
||||||
reversions = reversions | Version.objects.get_for_object(related_object)
|
reversions = reversions | Version.objects.get_for_object(related_object)
|
||||||
paginator = Paginator(reversions, pagination_number)
|
reversions = re2o_paginator(request, reversions, pagination_number)
|
||||||
page = request.GET.get('page')
|
|
||||||
try:
|
|
||||||
reversions = paginator.page(page)
|
|
||||||
except PageNotAnInteger:
|
|
||||||
# If page is not an integer, deliver first page.
|
|
||||||
reversions = paginator.page(1)
|
|
||||||
except EmptyPage:
|
|
||||||
# If page is out of range (e.g. 9999), deliver last page of result
|
|
||||||
reversions = paginator.page(paginator.num_pages)
|
|
||||||
return render(
|
return render(
|
||||||
request,
|
request,
|
||||||
're2o/history.html',
|
're2o/history.html',
|
||||||
|
|
|
@ -43,7 +43,6 @@ from django.db import IntegrityError
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
from django.db.models import ProtectedError, Prefetch
|
from django.db.models import ProtectedError, Prefetch
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
|
|
||||||
|
|
||||||
from topologie.models import (
|
from topologie.models import (
|
||||||
Switch,
|
Switch,
|
||||||
|
@ -66,7 +65,7 @@ from topologie.forms import (
|
||||||
EditAccessPointForm
|
EditAccessPointForm
|
||||||
)
|
)
|
||||||
from users.views import form
|
from users.views import form
|
||||||
from re2o.utils import SortTable
|
from re2o.utils import re2o_paginator, SortTable
|
||||||
from re2o.acl import (
|
from re2o.acl import (
|
||||||
can_create,
|
can_create,
|
||||||
can_edit,
|
can_edit,
|
||||||
|
@ -103,16 +102,7 @@ def index(request):
|
||||||
SortTable.TOPOLOGIE_INDEX
|
SortTable.TOPOLOGIE_INDEX
|
||||||
)
|
)
|
||||||
pagination_number = GeneralOption.get_cached_value('pagination_number')
|
pagination_number = GeneralOption.get_cached_value('pagination_number')
|
||||||
paginator = Paginator(switch_list, pagination_number)
|
switch_list = re2o_paginator(request, switch_list, pagination_number)
|
||||||
page = request.GET.get('page')
|
|
||||||
try:
|
|
||||||
switch_list = paginator.page(page)
|
|
||||||
except PageNotAnInteger:
|
|
||||||
# If page is not an integer, deliver first page.
|
|
||||||
switch_list = paginator.page(1)
|
|
||||||
except EmptyPage:
|
|
||||||
# If page is out of range (e.g. 9999), deliver last page of results.
|
|
||||||
switch_list = paginator.page(paginator.num_pages)
|
|
||||||
return render(request, 'topologie/index.html', {
|
return render(request, 'topologie/index.html', {
|
||||||
'switch_list': switch_list
|
'switch_list': switch_list
|
||||||
})
|
})
|
||||||
|
@ -158,16 +148,7 @@ def index_room(request):
|
||||||
SortTable.TOPOLOGIE_INDEX_ROOM
|
SortTable.TOPOLOGIE_INDEX_ROOM
|
||||||
)
|
)
|
||||||
pagination_number = GeneralOption.get_cached_value('pagination_number')
|
pagination_number = GeneralOption.get_cached_value('pagination_number')
|
||||||
paginator = Paginator(room_list, pagination_number)
|
room_list = re2o_paginator(request, room_list, pagination_number)
|
||||||
page = request.GET.get('page')
|
|
||||||
try:
|
|
||||||
room_list = paginator.page(page)
|
|
||||||
except PageNotAnInteger:
|
|
||||||
# If page is not an integer, deliver first page.
|
|
||||||
room_list = paginator.page(1)
|
|
||||||
except EmptyPage:
|
|
||||||
# If page is out of range (e.g. 9999), deliver last page of results.
|
|
||||||
room_list = paginator.page(paginator.num_pages)
|
|
||||||
return render(request, 'topologie/index_room.html', {
|
return render(request, 'topologie/index_room.html', {
|
||||||
'room_list': room_list
|
'room_list': room_list
|
||||||
})
|
})
|
||||||
|
@ -189,16 +170,7 @@ def index_ap(request):
|
||||||
SortTable.TOPOLOGIE_INDEX_BORNE
|
SortTable.TOPOLOGIE_INDEX_BORNE
|
||||||
)
|
)
|
||||||
pagination_number = GeneralOption.get_cached_value('pagination_number')
|
pagination_number = GeneralOption.get_cached_value('pagination_number')
|
||||||
paginator = Paginator(ap_list, pagination_number)
|
ap_list = re2o_paginator(request, ap_list, pagination_number)
|
||||||
page = request.GET.get('page')
|
|
||||||
try:
|
|
||||||
ap_list = paginator.page(page)
|
|
||||||
except PageNotAnInteger:
|
|
||||||
# If page is not an integer, deliver first page.
|
|
||||||
ap_list = paginator.page(1)
|
|
||||||
except EmptyPage:
|
|
||||||
# If page is out of range (e.g. 9999), deliver last page of results.
|
|
||||||
ap_list = paginator.page(paginator.num_pages)
|
|
||||||
return render(request, 'topologie/index_ap.html', {
|
return render(request, 'topologie/index_ap.html', {
|
||||||
'ap_list': ap_list
|
'ap_list': ap_list
|
||||||
})
|
})
|
||||||
|
@ -209,7 +181,7 @@ def index_ap(request):
|
||||||
def index_stack(request):
|
def index_stack(request):
|
||||||
"""Affichage de la liste des stacks (affiche l'ensemble des switches)"""
|
"""Affichage de la liste des stacks (affiche l'ensemble des switches)"""
|
||||||
stack_list = Stack.objects\
|
stack_list = Stack.objects\
|
||||||
.prefetch_related('switch_set__domain__extension')
|
.prefetch_related('switch_set__interface_set__domain__extension')
|
||||||
stack_list = SortTable.sort(
|
stack_list = SortTable.sort(
|
||||||
stack_list,
|
stack_list,
|
||||||
request.GET.get('col'),
|
request.GET.get('col'),
|
||||||
|
|
|
@ -548,15 +548,15 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser, PermissionsMix
|
||||||
'welcome_mail_en': mailmessageoptions.welcome_mail_en,
|
'welcome_mail_en': mailmessageoptions.welcome_mail_en,
|
||||||
'pseudo': self.pseudo,
|
'pseudo': self.pseudo,
|
||||||
})
|
})
|
||||||
#send_mail(
|
send_mail(
|
||||||
# 'Bienvenue au %(name)s / Welcome to %(name)s' % {
|
'Bienvenue au %(name)s / Welcome to %(name)s' % {
|
||||||
# 'name': AssoOption.get_cached_value('name')
|
'name': AssoOption.get_cached_value('name')
|
||||||
# },
|
},
|
||||||
# '',
|
'',
|
||||||
# GeneralOption.get_cached_value('email_from'),
|
GeneralOption.get_cached_value('email_from'),
|
||||||
# [self.email],
|
[self.email],
|
||||||
# html_message=template.render(context)
|
html_message=template.render(context)
|
||||||
#)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
def reset_passwd_mail(self, request):
|
def reset_passwd_mail(self, request):
|
||||||
|
@ -576,14 +576,14 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser, PermissionsMix
|
||||||
reverse('users:process', kwargs={'token': req.token})),
|
reverse('users:process', kwargs={'token': req.token})),
|
||||||
'expire_in': str(GeneralOption.get_cached_value('req_expire_hrs')) + ' heures',
|
'expire_in': str(GeneralOption.get_cached_value('req_expire_hrs')) + ' heures',
|
||||||
}
|
}
|
||||||
#send_mail(
|
send_mail(
|
||||||
# 'Changement de mot de passe du %(name)s / Password\
|
'Changement de mot de passe du %(name)s / Password\
|
||||||
# renewal for %(name)s' % {'name': AssoOption.get_cached_value('name')},
|
renewal for %(name)s' % {'name': AssoOption.get_cached_value('name')},
|
||||||
# template.render(context),
|
template.render(context),
|
||||||
# GeneralOption.get_cached_value('email_from'),
|
GeneralOption.get_cached_value('email_from'),
|
||||||
# [req.user.email],
|
[req.user.email],
|
||||||
# fail_silently=False
|
fail_silently=False
|
||||||
#)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
def autoregister_machine(self, mac_address, nas_type):
|
def autoregister_machine(self, mac_address, nas_type):
|
||||||
|
@ -1127,13 +1127,13 @@ class Ban(RevMixin, AclMixin, models.Model):
|
||||||
'date_end': self.date_end,
|
'date_end': self.date_end,
|
||||||
'asso_name': AssoOption.get_cached_value('name'),
|
'asso_name': AssoOption.get_cached_value('name'),
|
||||||
})
|
})
|
||||||
#send_mail(
|
send_mail(
|
||||||
# 'Deconnexion disciplinaire',
|
'Deconnexion disciplinaire',
|
||||||
# template.render(context),
|
template.render(context),
|
||||||
# GeneralOption.get_cached_value('email_from'),
|
GeneralOption.get_cached_value('email_from'),
|
||||||
# [self.user.email],
|
[self.user.email],
|
||||||
# fail_silently=False
|
fail_silently=False
|
||||||
#)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
def is_active(self):
|
def is_active(self):
|
||||||
|
|
|
@ -49,50 +49,36 @@ non adhérent</span>{% endif %} et votre connexion est {% if users.has_access %}
|
||||||
<h3 class="panel-title pull-left" >
|
<h3 class="panel-title pull-left" >
|
||||||
<i class="fa fa-user"></i> Informations détaillées
|
<i class="fa fa-user"></i> Informations détaillées
|
||||||
</h3>
|
</h3>
|
||||||
<div class="dropdown pull-right">
|
|
||||||
<a class="btn btn-default btn-sm" id="editionuser" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
|
||||||
<i class="fa fa-edit"></i> <span class="caret"></span>
|
|
||||||
</a>
|
|
||||||
<ul class="dropdown-menu" arialabelledby="editionuser">
|
|
||||||
<li>
|
|
||||||
<a href="{% url 'users:edit-info' users.id %}">
|
|
||||||
<i class="fa fa-edit"></i>
|
|
||||||
Editer
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="{% url 'users:password' users.id %}">
|
|
||||||
<i class="fa fa-lock"></i>
|
|
||||||
Changer le mot de passe
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
{% can_change User state %}
|
|
||||||
<li>
|
|
||||||
<a href="{% url 'users:state' users.id %}">
|
|
||||||
<i class="fa fa-id-badge"></i>
|
|
||||||
Changer le statut
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
{% acl_end %}
|
|
||||||
{% can_change User groups %}
|
|
||||||
<li>
|
|
||||||
<a href="{% url 'users:groups' users.id %}">
|
|
||||||
<i class="fa fa-check"></i>
|
|
||||||
Gérer les groupes
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
{% acl_end %}
|
|
||||||
<li>
|
|
||||||
<a href="{% url 'users:history' 'user' users.id %}">
|
|
||||||
<i class="fa fa-history"></i>
|
|
||||||
Historique
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-collapse collapse in" id="collapse1">
|
<div class="panel-collapse collapse in" id="collapse1">
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:edit-info' users.id %}">
|
||||||
|
<i class="fa fa-edit"></i>
|
||||||
|
Editer
|
||||||
|
</a>
|
||||||
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:password' users.id %}">
|
||||||
|
<i class="fa fa-lock"></i>
|
||||||
|
Changer le mot de passe
|
||||||
|
</a>
|
||||||
|
{% can_change User state %}
|
||||||
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:state' users.id %}">
|
||||||
|
<i class="fa fa-id-badge"></i>
|
||||||
|
Changer le statut
|
||||||
|
</a>
|
||||||
|
{% acl_end %}
|
||||||
|
{% can_change User groups %}
|
||||||
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:groups' users.id %}">
|
||||||
|
<i class="fa fa-check"></i>
|
||||||
|
Gérer les groupes
|
||||||
|
</a>
|
||||||
|
{% acl_end %}
|
||||||
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:history' 'user' users.id %}">
|
||||||
|
<i class="fa fa-history"></i>
|
||||||
|
Historique
|
||||||
|
</a>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -194,23 +180,16 @@ non adhérent</span>{% endif %} et votre connexion est {% if users.has_access %}
|
||||||
<h3 class="panel-title pull-left">
|
<h3 class="panel-title pull-left">
|
||||||
<i class="fa fa-users"></i> Gérer le club
|
<i class="fa fa-users"></i> Gérer le club
|
||||||
</h3>
|
</h3>
|
||||||
<div class="dropdown pull-right">
|
|
||||||
<a class="btn btn-default btn-sm" id="editionclub" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
|
||||||
<i class="fa fa-edit"></i> <span class="caret"></span>
|
|
||||||
</a>
|
|
||||||
<ul class="dropdown-menu" arialabelledby="editionclub">
|
|
||||||
<li>
|
|
||||||
<a href="{% url 'users:edit-club-admin-members' users.club.id %}">
|
|
||||||
<i class="fa fa-lock"></i>
|
|
||||||
Gérer admin et membres
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-collapse collapse" id="collapse2">
|
<div class="panel-collapse collapse" id="collapse2">
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<h4>Administrateurs du club</h4>
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:edit-club-admin-members' users.club.id %}">
|
||||||
|
<i class="fa fa-lock"></i>
|
||||||
|
Gérer admin et membres
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<h4>Administrateurs du club</h4>
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
|
@ -259,21 +238,14 @@ non adhérent</span>{% endif %} et votre connexion est {% if users.has_access %}
|
||||||
Machines
|
Machines
|
||||||
<span class="badge">{{machines_list.count}}</span>
|
<span class="badge">{{machines_list.count}}</span>
|
||||||
</h3>
|
</h3>
|
||||||
<div class="dropdown pull-right">
|
</div>
|
||||||
<a class="btn btn-default btn-sm" id="editionmachines" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
|
||||||
<i class="fa fa-edit"></i> <span class="caret"></span>
|
|
||||||
</a>
|
|
||||||
<ul class="dropdown-menu" arialabelledby="editionmachines">
|
|
||||||
<li>
|
|
||||||
<a href="{% url 'machines:new-machine' users.id %}">
|
|
||||||
<i class="fa fa-desktop"></i>
|
|
||||||
Ajouter une machine
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="collapse3" class="panel-collapse collapse">
|
<div id="collapse3" class="panel-collapse collapse">
|
||||||
|
<div class="panel-body">
|
||||||
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:new-machine' users.id %}">
|
||||||
|
<i class="fa fa-desktop"></i>
|
||||||
|
Ajouter une machine
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
{% if machines_list %}
|
{% if machines_list %}
|
||||||
{% include "machines/aff_machines.html" with machines_list=machines_list %}
|
{% include "machines/aff_machines.html" with machines_list=machines_list %}
|
||||||
|
@ -289,37 +261,26 @@ non adhérent</span>{% endif %} et votre connexion est {% if users.has_access %}
|
||||||
<i class="fa fa-euro-sign"></i>
|
<i class="fa fa-euro-sign"></i>
|
||||||
Cotisations
|
Cotisations
|
||||||
</h3>
|
</h3>
|
||||||
<div class="dropdown pull-right">
|
|
||||||
<a class="btn btn-default btn-sm" id="editionfacture" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
|
||||||
<i class="fa fa-edit"></i> <span class="caret"></span>
|
|
||||||
</a>
|
|
||||||
<ul class="dropdown-menu" arialabelledby="editionfacture">
|
|
||||||
{% can_create Facture %}
|
|
||||||
<li>
|
|
||||||
<a href="{% url 'cotisations:new-facture' users.id %}">
|
|
||||||
<i class="fa fa-euro-sign"></i>
|
|
||||||
Ajouter une cotisation
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
{% if user_solde %}
|
|
||||||
<li>
|
|
||||||
<a href="{% url 'cotisations:credit-solde' users.id %}">
|
|
||||||
<i class="fa fa-euro-sign"></i>
|
|
||||||
Modifier le solde
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
{% endif%}{% acl_else %}
|
|
||||||
{% if user_solde %}
|
|
||||||
<li>
|
|
||||||
<a href="{% url 'cotisations:new_facture_solde' user.id %}">
|
|
||||||
<i class="fa fa-euro-sign"></i>
|
|
||||||
Ajouter une cotisation par solde</a>{% endif %}{% acl_end %}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div id="collapse4" class="panel-collapse collapse">
|
<div id="collapse4" class="panel-collapse collapse">
|
||||||
|
<div class="panel-body">
|
||||||
|
{% can_create Facture %}
|
||||||
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'cotisations:new-facture' users.id %}">
|
||||||
|
<i class="fa fa-euro-sign"></i>
|
||||||
|
Ajouter une cotisation
|
||||||
|
</a>
|
||||||
|
{% if user_solde %}
|
||||||
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'cotisations:credit-solde' users.id %}">
|
||||||
|
<i class="fa fa-euro-sign"></i>
|
||||||
|
Modifier le solde
|
||||||
|
</a>
|
||||||
|
{% endif%}{% acl_else %}
|
||||||
|
{% if user_solde %}
|
||||||
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'cotisations:new_facture_solde' user.id %}">
|
||||||
|
<i class="fa fa-euro-sign"></i>
|
||||||
|
Ajouter une cotisation par solde</a>{% endif %}{% acl_end %}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
{% if facture_list %}
|
{% if facture_list %}
|
||||||
{% include "cotisations/aff_cotisations.html" with facture_list=facture_list %}
|
{% include "cotisations/aff_cotisations.html" with facture_list=facture_list %}
|
||||||
|
@ -335,23 +296,16 @@ non adhérent</span>{% endif %} et votre connexion est {% if users.has_access %}
|
||||||
<i class="fa fa-ban"></i>
|
<i class="fa fa-ban"></i>
|
||||||
Bannissements
|
Bannissements
|
||||||
</h3>
|
</h3>
|
||||||
<div class="dropdown pull-right">
|
</div>
|
||||||
<a class="btn btn-default btn-sm" id="editionban" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
|
||||||
<i class="fa fa-edit"></i> <span class="caret"></span>
|
|
||||||
</a>
|
|
||||||
<ul class="dropdown-menu" arialabelledby="editionban">
|
|
||||||
{% can_create Ban %}
|
|
||||||
<li>
|
|
||||||
<a href="{% url 'users:add-ban' users.id %}">
|
|
||||||
<i class="fa fa-ban"></i>
|
|
||||||
Ajouter un bannissement
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
{% acl_end %}
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="collapse5" class="panel-collapse collapse">
|
<div id="collapse5" class="panel-collapse collapse">
|
||||||
|
<div class="panel-body">
|
||||||
|
{% can_create Ban %}
|
||||||
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:add-ban' users.id %}">
|
||||||
|
<i class="fa fa-ban"></i>
|
||||||
|
Ajouter un bannissement
|
||||||
|
</a>
|
||||||
|
{% acl_end %}
|
||||||
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
{% if ban_list %}
|
{% if ban_list %}
|
||||||
{% include "users/aff_bans.html" with ban_list=ban_list %}
|
{% include "users/aff_bans.html" with ban_list=ban_list %}
|
||||||
|
@ -367,23 +321,16 @@ non adhérent</span>{% endif %} et votre connexion est {% if users.has_access %}
|
||||||
<i class="fa fa-check-circle"></i>
|
<i class="fa fa-check-circle"></i>
|
||||||
Accès à titre gracieux
|
Accès à titre gracieux
|
||||||
</h3>
|
</h3>
|
||||||
<div class="dropdown pull-right">
|
|
||||||
<a class="btn btn-default btn-sm" id="editionwhitelist" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
|
||||||
<i class="fa fa-edit"></i> <span class="caret"></span>
|
|
||||||
</a>
|
|
||||||
<ul class="dropdown-menu" arialabelledby="editionwhitelist">
|
|
||||||
{% can_create Whitelist %}
|
|
||||||
<li>
|
|
||||||
<a href="{% url 'users:add-whitelist' users.id %}">
|
|
||||||
<i class="fa fa-check-circle"></i>
|
|
||||||
Accorder un accès à titre gracieux
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
{% acl_end %}
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div id="collapse6" class="panel-collapse collapse">
|
<div id="collapse6" class="panel-collapse collapse">
|
||||||
|
<div class="panel-body">
|
||||||
|
{% can_create Whitelist %}
|
||||||
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:add-whitelist' users.id %}">
|
||||||
|
<i class="fa fa-check-circle"></i>
|
||||||
|
Accorder un accès à titre gracieux
|
||||||
|
</a>
|
||||||
|
{% acl_end %}
|
||||||
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
{% if white_list %}
|
{% if white_list %}
|
||||||
{% include "users/aff_whitelists.html" with white_list=white_list %}
|
{% include "users/aff_whitelists.html" with white_list=white_list %}
|
||||||
|
|
|
@ -45,12 +45,12 @@ urlpatterns = [
|
||||||
url(r'^del_group/(?P<userid>[0-9]+)/(?P<listrightid>[0-9]+)$', views.del_group, name='del-group'),
|
url(r'^del_group/(?P<userid>[0-9]+)/(?P<listrightid>[0-9]+)$', views.del_group, name='del-group'),
|
||||||
url(r'^new_serviceuser/$', views.new_serviceuser, name='new-serviceuser'),
|
url(r'^new_serviceuser/$', views.new_serviceuser, name='new-serviceuser'),
|
||||||
url(
|
url(
|
||||||
r'^edit_serviceuser/(?P<userid>[0-9]+)$',
|
r'^edit_serviceuser/(?P<serviceuserid>[0-9]+)$',
|
||||||
views.edit_serviceuser,
|
views.edit_serviceuser,
|
||||||
name='edit-serviceuser'
|
name='edit-serviceuser'
|
||||||
),
|
),
|
||||||
url(
|
url(
|
||||||
r'^del_serviceuser/(?P<userid>[0-9]+)$',
|
r'^del_serviceuser/(?P<serviceuserid>[0-9]+)$',
|
||||||
views.del_serviceuser,
|
views.del_serviceuser,
|
||||||
name='del-serviceuser'
|
name='del-serviceuser'
|
||||||
),
|
),
|
||||||
|
|
|
@ -37,7 +37,6 @@ from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.shortcuts import get_object_or_404, render, redirect
|
from django.shortcuts import get_object_or_404, render, redirect
|
||||||
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
|
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.contrib.auth.decorators import login_required, permission_required
|
from django.contrib.auth.decorators import login_required, permission_required
|
||||||
from django.db.models import ProtectedError, Q
|
from django.db.models import ProtectedError, Q
|
||||||
|
@ -95,6 +94,7 @@ from re2o.views import form
|
||||||
from re2o.utils import (
|
from re2o.utils import (
|
||||||
all_has_access,
|
all_has_access,
|
||||||
SortTable,
|
SortTable,
|
||||||
|
re2o_paginator
|
||||||
)
|
)
|
||||||
from re2o.acl import (
|
from re2o.acl import (
|
||||||
can_create,
|
can_create,
|
||||||
|
@ -198,14 +198,12 @@ def state(request, user, userid):
|
||||||
need droit bureau """
|
need droit bureau """
|
||||||
state = StateForm(request.POST or None, instance=user)
|
state = StateForm(request.POST or None, instance=user)
|
||||||
if state.is_valid():
|
if state.is_valid():
|
||||||
if state.cleaned_data['state'] == User.STATE_ARCHIVE:
|
if state.changed_data:
|
||||||
user.archive()
|
if state.cleaned_data['state'] == User.STATE_ARCHIVE:
|
||||||
elif state.cleaned_data['state'] == User.STATE_ACTIVE:
|
user.archive()
|
||||||
user.unarchive()
|
elif state.cleaned_data['state'] == User.STATE_ACTIVE:
|
||||||
elif state.cleaned_data['state'] == User.STATE_DISABLED:
|
user.unarchive()
|
||||||
user.state = User.STATE_DISABLED
|
state.save()
|
||||||
if user.changed_data:
|
|
||||||
user.save()
|
|
||||||
messages.success(request, "Etat changé avec succès")
|
messages.success(request, "Etat changé avec succès")
|
||||||
return redirect(reverse(
|
return redirect(reverse(
|
||||||
'users:profil',
|
'users:profil',
|
||||||
|
@ -275,7 +273,7 @@ def new_serviceuser(request):
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@can_edit(ServiceUser)
|
@can_edit(ServiceUser)
|
||||||
def edit_serviceuser(request, user, userid):
|
def edit_serviceuser(request, serviceuser, serviceuserid):
|
||||||
""" Edit a ServiceUser """
|
""" Edit a ServiceUser """
|
||||||
user = EditServiceUserForm(request.POST or None, instance=user)
|
user = EditServiceUserForm(request.POST or None, instance=user)
|
||||||
if user.is_valid():
|
if user.is_valid():
|
||||||
|
@ -286,19 +284,19 @@ def edit_serviceuser(request, user, userid):
|
||||||
user_object.save()
|
user_object.save()
|
||||||
messages.success(request, "L'user a bien été modifié")
|
messages.success(request, "L'user a bien été modifié")
|
||||||
return redirect(reverse('users:index-serviceusers'))
|
return redirect(reverse('users:index-serviceusers'))
|
||||||
return form({'userform': user, 'action_name':'Editer un serviceuser'}, 'users/user.html', request)
|
return form({'userform': serviceuser, 'action_name':'Editer un serviceuser'}, 'users/user.html', request)
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@can_delete(ServiceUser)
|
@can_delete(ServiceUser)
|
||||||
def del_serviceuser(request, user, userid):
|
def del_serviceuser(request, serviceuser, serviceuserid):
|
||||||
"""Suppression d'un ou plusieurs serviceusers"""
|
"""Suppression d'un ou plusieurs serviceusers"""
|
||||||
if request.method == "POST":
|
if request.method == "POST":
|
||||||
user.delete()
|
user.delete()
|
||||||
messages.success(request, "L'user a été détruite")
|
messages.success(request, "L'user a été détruite")
|
||||||
return redirect(reverse('users:index-serviceusers'))
|
return redirect(reverse('users:index-serviceusers'))
|
||||||
return form(
|
return form(
|
||||||
{'objet': user, 'objet_name': 'serviceuser'},
|
{'objet': serviceuser, 'objet_name': 'serviceuser'},
|
||||||
'users/delete.html',
|
'users/delete.html',
|
||||||
request
|
request
|
||||||
)
|
)
|
||||||
|
@ -572,16 +570,7 @@ def index(request):
|
||||||
request.GET.get('order'),
|
request.GET.get('order'),
|
||||||
SortTable.USERS_INDEX
|
SortTable.USERS_INDEX
|
||||||
)
|
)
|
||||||
paginator = Paginator(users_list, pagination_number)
|
users_list = re2o_paginator(request, users_list, pagination_number)
|
||||||
page = request.GET.get('page')
|
|
||||||
try:
|
|
||||||
users_list = paginator.page(page)
|
|
||||||
except PageNotAnInteger:
|
|
||||||
# If page is not an integer, deliver first page.
|
|
||||||
users_list = paginator.page(1)
|
|
||||||
except EmptyPage:
|
|
||||||
# If page is out of range (e.g. 9999), deliver last page of results.
|
|
||||||
users_list = paginator.page(paginator.num_pages)
|
|
||||||
return render(request, 'users/index.html', {'users_list': users_list})
|
return render(request, 'users/index.html', {'users_list': users_list})
|
||||||
|
|
||||||
|
|
||||||
|
@ -597,16 +586,7 @@ def index_clubs(request):
|
||||||
request.GET.get('order'),
|
request.GET.get('order'),
|
||||||
SortTable.USERS_INDEX
|
SortTable.USERS_INDEX
|
||||||
)
|
)
|
||||||
paginator = Paginator(clubs_list, pagination_number)
|
clubs_list = re2o_paginator(request, clubs_list, pagination_number)
|
||||||
page = request.GET.get('page')
|
|
||||||
try:
|
|
||||||
clubs_list = paginator.page(page)
|
|
||||||
except PageNotAnInteger:
|
|
||||||
# If page is not an integer, deliver first page.
|
|
||||||
clubs_list = paginator.page(1)
|
|
||||||
except EmptyPage:
|
|
||||||
# If page is out of range (e.g. 9999), deliver last page of results.
|
|
||||||
clubs_list = paginator.page(paginator.num_pages)
|
|
||||||
return render(request, 'users/index_clubs.html', {'clubs_list': clubs_list})
|
return render(request, 'users/index_clubs.html', {'clubs_list': clubs_list})
|
||||||
|
|
||||||
|
|
||||||
|
@ -622,16 +602,7 @@ def index_ban(request):
|
||||||
request.GET.get('order'),
|
request.GET.get('order'),
|
||||||
SortTable.USERS_INDEX_BAN
|
SortTable.USERS_INDEX_BAN
|
||||||
)
|
)
|
||||||
paginator = Paginator(ban_list, pagination_number)
|
ban_list = re2o_paginator(request, ban_list, pagination_number)
|
||||||
page = request.GET.get('page')
|
|
||||||
try:
|
|
||||||
ban_list = paginator.page(page)
|
|
||||||
except PageNotAnInteger:
|
|
||||||
# If page isn't an integer, deliver first page
|
|
||||||
ban_list = paginator.page(1)
|
|
||||||
except EmptyPage:
|
|
||||||
# If page is out of range (e.g. 9999), deliver last page of results.
|
|
||||||
ban_list = paginator.page(paginator.num_pages)
|
|
||||||
return render(request, 'users/index_ban.html', {'ban_list': ban_list})
|
return render(request, 'users/index_ban.html', {'ban_list': ban_list})
|
||||||
|
|
||||||
|
|
||||||
|
@ -647,16 +618,7 @@ def index_white(request):
|
||||||
request.GET.get('order'),
|
request.GET.get('order'),
|
||||||
SortTable.USERS_INDEX_BAN
|
SortTable.USERS_INDEX_BAN
|
||||||
)
|
)
|
||||||
paginator = Paginator(white_list, pagination_number)
|
white_list = re2o_paginator(request, white_list, pagination_number)
|
||||||
page = request.GET.get('page')
|
|
||||||
try:
|
|
||||||
white_list = paginator.page(page)
|
|
||||||
except PageNotAnInteger:
|
|
||||||
# If page isn't an integer, deliver first page
|
|
||||||
white_list = paginator.page(1)
|
|
||||||
except EmptyPage:
|
|
||||||
# If page is out of range (e.g. 9999), deliver last page of results.
|
|
||||||
white_list = paginator.page(paginator.num_pages)
|
|
||||||
return render(
|
return render(
|
||||||
request,
|
request,
|
||||||
'users/index_whitelist.html',
|
'users/index_whitelist.html',
|
||||||
|
@ -676,16 +638,7 @@ def index_school(request):
|
||||||
request.GET.get('order'),
|
request.GET.get('order'),
|
||||||
SortTable.USERS_INDEX_SCHOOL
|
SortTable.USERS_INDEX_SCHOOL
|
||||||
)
|
)
|
||||||
paginator = Paginator(school_list, pagination_number)
|
school_list = re2o_paginator(request, 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',
|
||||||
|
@ -754,6 +707,8 @@ def profil(request, users, userid):
|
||||||
request.GET.get('order'),
|
request.GET.get('order'),
|
||||||
SortTable.MACHINES_INDEX
|
SortTable.MACHINES_INDEX
|
||||||
)
|
)
|
||||||
|
pagination_large_number = GeneralOption.get_cached_value('pagination_large_number')
|
||||||
|
machines = re2o_paginator(request, machines, pagination_large_number)
|
||||||
factures = Facture.objects.filter(user=users)
|
factures = Facture.objects.filter(user=users)
|
||||||
factures = SortTable.sort(
|
factures = SortTable.sort(
|
||||||
factures,
|
factures,
|
||||||
|
|
Loading…
Reference in a new issue