diff --git a/.gitignore b/.gitignore
index b02c3e9a..e81c4706 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,5 @@
settings_local.py
*.swp
*.pyc
-__pycache__
+__pycache__/*
static_files/*
diff --git a/re2o/settings.py b/re2o/settings.py
index a23744b8..21228199 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, MAIN_EXTENSION, GID_RANGES, UID_RANGES
+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, GID_RANGES, UID_RANGES, SEARCH_RESULT
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 0cdfe115..4c1e2345 100644
--- a/search/templates/search/index.html
+++ b/search/templates/search/index.html
@@ -35,7 +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)
+ (Seulement les {{ max_result }} premiers résultats sont affichés dans chaque catégorie)
diff --git a/search/views.py b/search/views.py
index 4249f9b7..dabc6b19 100644
--- a/search/views.py
+++ b/search/views.py
@@ -14,6 +14,8 @@ from topologie.models import Port, Switch
from cotisations.models import Facture
from search.models import SearchForm, SearchFormPlus
+from re2o.settings import SEARCH_RESULT
+
def form(ctx, template, request):
c = ctx
c.update(csrf(request))
@@ -54,21 +56,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)[:15]
+ users = User.objects.filter((Q(pseudo__icontains = search) | Q(name__icontains = search) | Q(surname__icontains = search)) & query)[:SEARCH_RESULT]
query = Q(user__pseudo__icontains = search) | Q(user__name__icontains = search) | Q(user__surname__icontains = search)
if i == '1':
- machines = Machine.objects.filter(query)[:15]
+ machines = Machine.objects.filter(query)[:SEARCH_RESULT]
if i == '2':
- factures = Facture.objects.filter(query & date_query)[:15]
+ factures = Facture.objects.filter(query & date_query)[:SEARCH_RESULT]
if i == '3':
- bans = Ban.objects.filter(query)[:15]
+ bans = Ban.objects.filter(query)[:SEARCH_RESULT]
if i == '4':
- whitelists = Whitelist.objects.filter(query)[:15]
+ whitelists = Whitelist.objects.filter(query)[:SEARCH_RESULT]
if i == '5':
- portlist = Port.objects.filter(details__icontains = search)[:15]
+ portlist = Port.objects.filter(details__icontains = search)[:SEARCH_RESULT]
if i == '6':
- 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}
+ switchlist = Switch.objects.filter(details__icontains = search)[:SEARCH_RESULT]
+ return {'users_list': users, 'machines_list' : machines, 'facture_list' : factures, 'ban_list' : bans, 'white_list': whitelists, 'port_list':portlist, 'switch_list':switchlist, 'max_result' : SEARCH_RESULT}
@login_required
def search(request):