diff --git a/preferences/migrations/0029_auto_20180318_0213.py b/preferences/migrations/0029_auto_20180318_0213.py
new file mode 100644
index 00000000..83d135b4
--- /dev/null
+++ b/preferences/migrations/0029_auto_20180318_0213.py
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.7 on 2018-03-18 01:13
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('preferences', '0028_assooption_description'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='assooption',
+ name='description',
+ field=models.TextField(blank=True, null=True),
+ ),
+ ]
diff --git a/preferences/models.py b/preferences/models.py
index 220f8a82..8678289f 100644
--- a/preferences/models.py
+++ b/preferences/models.py
@@ -563,7 +563,10 @@ class AssoOption(PreferencesModel):
null=True,
blank=True,
)
- description = models.TextField(default="")
+ description = models.TextField(
+ null=True,
+ blank=True,
+ )
class Meta:
permissions = (
diff --git a/preferences/templates/preferences/display_preferences.html b/preferences/templates/preferences/display_preferences.html
index 67666bac..26fc0308 100644
--- a/preferences/templates/preferences/display_preferences.html
+++ b/preferences/templates/preferences/display_preferences.html
@@ -57,10 +57,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
Creations de clubs par tous |
{{ useroptions.all_can_create_club }} |
-
- Auto inscription |
- {{ useroptions.self_adhesion }} |
-
{% if useroptions.user_solde %}
Solde maximum |
@@ -69,6 +65,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{{ useroptions.min_online_payment }} |
{% endif %}
+
+ Auto inscription |
+ {{ useroptions.self_adhesion }} |
+
Préférences machines
@@ -185,7 +185,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{{ assooptions.utilisateur_asso }} |
Moyen de paiement automatique |
{{ assooptions.payment }} |
- Description de l'association |
+
+
+ Description de l'association |
{{ assooptions.description }} |
diff --git a/search/templates/search/index.html b/search/templates/search/index.html
index 98658bfb..2fad0c89 100644
--- a/search/templates/search/index.html
+++ b/search/templates/search/index.html
@@ -32,6 +32,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
Résultats dans les utilisateurs
{% include "users/aff_users.html" with users_list=users %}
{% endif%}
+ {% if clubs %}
+ Résultats dans les clubs
+ {% include "users/aff_clubs.html" with clubs_list=clubs %}
+ {% endif%}
{% if machines %}
Résultats dans les machines :
{% include "machines/aff_machines.html" with machines_list=machines %}
diff --git a/search/views.py b/search/views.py
index cc33bb7c..601f4eeb 100644
--- a/search/views.py
+++ b/search/views.py
@@ -31,7 +31,7 @@ from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from django.db.models import Q
-from users.models import User, Ban, Whitelist
+from users.models import User, Adherent, Club, Ban, Whitelist
from machines.models import Machine
from topologie.models import Port, Switch, Room
from cotisations.models import Facture
@@ -133,19 +133,20 @@ def search_single_word(word, filters, user,
filter_users = (
Q(
surname__icontains=word
- ) | Q(
- adherent__name__icontains=word
) | Q(
pseudo__icontains=word
) | Q(
- club__room__name__icontains=word
+ room__name__icontains=word
) | Q(
- adherent__room__name__icontains=word
+ room__name__icontains=word
)
) & Q(state__in=user_state)
if not User.can_view_all(user)[0]:
filter_users &= Q(id=user.id)
+ filter_clubs = filter_users
+ filter_users |= Q(name__icontains=word)
filters['users'] |= filter_users
+ filters['clubs'] |= filter_clubs
# Machines
if '1' in aff:
@@ -359,6 +360,7 @@ def get_results(query, request, params):
filters = {
'users': Q(),
+ 'clubs': Q(),
'machines': Q(),
'factures': Q(),
'bans': Q(),
@@ -381,7 +383,8 @@ def get_results(query, request, params):
)
results = {
- 'users': User.objects.filter(filters['users']),
+ 'users': Adherent.objects.filter(filters['users']),
+ 'clubs': Club.objects.filter(filters['clubs']),
'machines': Machine.objects.filter(filters['machines']),
'factures': Facture.objects.filter(filters['factures']),
'bans': Ban.objects.filter(filters['bans']),