diff --git a/README.md b/README.md
index 967cae14..a495563f 100644
--- a/README.md
+++ b/README.md
@@ -19,7 +19,8 @@ Avec apt (recommandé):
* python3-dateutil (jessie-backports)
* texlive-latex-base (jessie)
* texlive-fonts-recommended (jessie)
- * python3-djangorestframework (stretch)
+ * python3-djangorestframework (jessie)
+ * python3-django-reversion (stretch)
Avec pip3:
* django-bootstrap3 (pip install)
@@ -28,9 +29,12 @@ Avec pip3:
Moteur de db conseillé (mysql), postgresql fonctionne également.
Pour mysql, il faut installer :
- * mysql-server (jessie)
* python3-mysqldb (jessie-backports)
+Sur le serveur mysql :
+ * mysql-server (jessie)
+
+
## Configuration
Le site est prêt a fonctionner, il faut simplement créer la base de donnée (par défaut re2o), et régler les variables présentes dans setting_local.py
diff --git a/cotisations/templates/cotisations/aff_cotisations.html b/cotisations/templates/cotisations/aff_cotisations.html
index dfee06e8..944c90fc 100644
--- a/cotisations/templates/cotisations/aff_cotisations.html
+++ b/cotisations/templates/cotisations/aff_cotisations.html
@@ -1,17 +1,6 @@
- {% if facture_list.paginator %}
-
- {% endif %}
+{% if facture_list.paginator %}
+{% include "pagination.html" with list=facture_list %}
+{% endif %}
diff --git a/machines/models.py b/machines/models.py
index 509fb2cb..a4c38aec 100644
--- a/machines/models.py
+++ b/machines/models.py
@@ -4,7 +4,7 @@ from django.dispatch import receiver
from django.forms import ValidationError
from macaddress.fields import MACAddressField
-
+from re2o.settings import MAIN_EXTENSION
class Machine(models.Model):
@@ -35,7 +35,7 @@ class Interface(models.Model):
machine = models.ForeignKey('Machine', on_delete=models.CASCADE)
type = models.ForeignKey('MachineType', on_delete=models.PROTECT)
details = models.CharField(max_length=255, blank=True)
- dns = models.CharField(help_text="Obligatoire et unique, doit se terminer en %s et ne pas comporter d'autres points" % ", ".join(Extension.objects.values_list('name', flat=True)), max_length=255, unique=True)
+ dns = models.CharField(help_text="Obligatoire et unique, doit se terminer par exemple en %s et ne pas comporter d'autres points" % MAIN_EXTENSION, max_length=255, unique=True)
def is_active(self):
""" Renvoie si une interface doit avoir accès ou non """
@@ -43,11 +43,6 @@ class Interface(models.Model):
user = self.machine.user
return machine.active and user.has_access()
- #def save(self, *args, **kwargs):
- # user = self.machine.user
- # user.ldap_sync(base=False, access_refresh=False, mac_refresh=True)
- # super(Interface, self).save(*args, **kwargs)
-
def __str__(self):
return self.dns
diff --git a/machines/serializers.py b/machines/serializers.py
index 375c4113..7b058d95 100644
--- a/machines/serializers.py
+++ b/machines/serializers.py
@@ -4,7 +4,7 @@ from machines.models import Interface
class InterfaceSerializer( serializers.ModelSerializer):
class Meta:
model = Interface
- fields = ('ipv4', 'mac_address', 'dns')
+ fields = ('ipv4', 'mac_address', 'dns', 'type')
diff --git a/machines/templates/machines/aff_machines.html b/machines/templates/machines/aff_machines.html
index 54be85e8..225c76ed 100644
--- a/machines/templates/machines/aff_machines.html
+++ b/machines/templates/machines/aff_machines.html
@@ -1,17 +1,6 @@
- {% if machines_list.paginator %}
-
- {% endif %}
+{% if machines_list.paginator %}
+{% include "pagination.html" with list=machines_list %}
+{% endif %}
diff --git a/machines/urls.py b/machines/urls.py
index 6327d2cc..5f1280f2 100644
--- a/machines/urls.py
+++ b/machines/urls.py
@@ -22,5 +22,5 @@ urlpatterns = [
url(r'^history/(?Pextension)/(?P[0-9]+)$', views.history, name='history'),
url(r'^$', views.index, name='index'),
url(r'^rest/mac-ip/$', views.mac_ip, name='mac-ip'),
- url(r'^rest/dns-ip/$', views.dns_ip, name='dns-ip'),
+ url(r'^rest/mac-ip-dns/$', views.mac_ip_dns, name='mac-ip-dns'),
]
diff --git a/machines/views.py b/machines/views.py
index 5843a88f..1eacebfe 100644
--- a/machines/views.py
+++ b/machines/views.py
@@ -415,8 +415,7 @@ def mac_ip(request):
s.pop('dns')
return JSONResponse(seria)
-def dns_ip(request):
+def mac_ip_dns(request):
seria = interface_list(request)
- for s in seria:
- s.pop('mac_address')
return JSONResponse(seria)
+
diff --git a/re2o/settings.py b/re2o/settings.py
index de49c713..cc8437bf 100644
--- a/re2o/settings.py
+++ b/re2o/settings.py
@@ -12,7 +12,7 @@ https://docs.djangoproject.com/en/1.8/ref/settings/
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
-from .settings_local import SECRET_KEY, DATABASES, DEBUG, ALLOWED_HOSTS, ASSO_NAME, ASSO_ADDRESS_LINE1, ASSO_ADDRESS_LINE2, ASSO_SIRET, ASSO_EMAIL, ASSO_PHONE, LOGO_PATH, services_urls, REQ_EXPIRE_HRS, REQ_EXPIRE_STR, EMAIL_FROM, SITE_NAME, LDAP
+from .settings_local import SECRET_KEY, DATABASES, DEBUG, ALLOWED_HOSTS, ASSO_NAME, ASSO_ADDRESS_LINE1, ASSO_ADDRESS_LINE2, ASSO_SIRET, ASSO_EMAIL, ASSO_PHONE, LOGO_PATH, services_urls, REQ_EXPIRE_HRS, REQ_EXPIRE_STR, EMAIL_FROM, SITE_NAME, LDAP, MAIN_EXTENSION, UID_RANGES
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
diff --git a/search/templates/search/index.html b/search/templates/search/index.html
index 9d60279d..0cdfe115 100644
--- a/search/templates/search/index.html
+++ b/search/templates/search/index.html
@@ -35,6 +35,7 @@
{% if not ban_list and not interfaces_list and not users_list and not facture_list and not white_list and not port_list and not switch_list%}
Aucun résultat
{% endif %}
+ (Seulement les 15 premiers résultats sont affichés dans chaque catégorie)
diff --git a/search/views.py b/search/views.py
index 22072e2e..4249f9b7 100644
--- a/search/views.py
+++ b/search/views.py
@@ -54,21 +54,21 @@ def search_result(search, type, request):
for i in aff:
if i == '0':
- users = User.objects.filter((Q(pseudo__icontains = search) | Q(name__icontains = search) | Q(surname__icontains = search)) & query)
+ users = User.objects.filter((Q(pseudo__icontains = search) | Q(name__icontains = search) | Q(surname__icontains = search)) & query)[:15]
query = Q(user__pseudo__icontains = search) | Q(user__name__icontains = search) | Q(user__surname__icontains = search)
if i == '1':
- machines = Interface.objects.filter(machine=Machine.objects.filter(query)) | Interface.objects.filter(Q(dns__icontains = search))
+ machines = Machine.objects.filter(query)[:15]
if i == '2':
- factures = Facture.objects.filter(query & date_query)
+ factures = Facture.objects.filter(query & date_query)[:15]
if i == '3':
- bans = Ban.objects.filter(query)
+ bans = Ban.objects.filter(query)[:15]
if i == '4':
- whitelists = Whitelist.objects.filter(query)
+ whitelists = Whitelist.objects.filter(query)[:15]
if i == '5':
- portlist = Port.objects.filter(details__icontains = search)
+ portlist = Port.objects.filter(details__icontains = search)[:15]
if i == '6':
- switchlist = Switch.objects.filter(details__icontains = search)
- return {'users_list': users, 'interfaces_list' : machines, 'facture_list' : factures, 'ban_list' : bans, 'white_list': whitelists, 'port_list':portlist, 'switch_list':switchlist}
+ switchlist = Switch.objects.filter(details__icontains = search)[:15]
+ return {'users_list': users, 'machines_list' : machines, 'facture_list' : factures, 'ban_list' : bans, 'white_list': whitelists, 'port_list':portlist, 'switch_list':switchlist}
@login_required
def search(request):
diff --git a/templates/pagination.html b/templates/pagination.html
new file mode 100644
index 00000000..f69799a9
--- /dev/null
+++ b/templates/pagination.html
@@ -0,0 +1,17 @@
+
+
diff --git a/users/migrations/0038_user_rezo_rez_uid.py b/users/migrations/0038_user_rezo_rez_uid.py
new file mode 100644
index 00000000..6665aae6
--- /dev/null
+++ b/users/migrations/0038_user_rezo_rez_uid.py
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('users', '0037_ldapuser_login_shell'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='user',
+ name='rezo_rez_uid',
+ field=models.IntegerField(null=True, blank=True, unique=True),
+ ),
+ ]
diff --git a/users/models.py b/users/models.py
index 1af9009e..019d6098 100644
--- a/users/models.py
+++ b/users/models.py
@@ -116,6 +116,7 @@ class User(AbstractBaseUser):
state = models.IntegerField(choices=STATES, default=STATE_ACTIVE)
registered = models.DateTimeField(auto_now_add=True)
uid_number = models.IntegerField(default=auto_uid, unique=True)
+ rezo_rez_uid = models.IntegerField(unique=True, blank=True, null=True)
USERNAME_FIELD = 'pseudo'
REQUIRED_FIELDS = ['name', 'surname', 'email']
diff --git a/users/templates/users/aff_users.html b/users/templates/users/aff_users.html
index c86efaf5..2830b1d1 100644
--- a/users/templates/users/aff_users.html
+++ b/users/templates/users/aff_users.html
@@ -1,17 +1,6 @@
- {% if users_list.paginator %}
-
- {% endif %}
+{% if users_list.paginator %}
+{% include "pagination.html" with list=users_list %}
+{% endif %}
@@ -19,6 +8,7 @@
Prénom
Nom
Pseudo
+ Uid
Fin de cotisation le
Connexion
Profil
@@ -29,6 +19,7 @@
{{ user.name }}
{{ user.surname }}
{{ user.pseudo }}
+ {{ user.uid_number }}
{% if user.is_adherent %}{{ user.end_adhesion }}{% else %}Non adhérent{% endif %}
{% if user.has_access == True %}
Active