8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-22 19:33:11 +00:00

Merge branch 'fix_divers' into 'master'

Fix divers

See merge request federez/re2o!101
This commit is contained in:
klafyvel 2018-03-18 12:41:08 +01:00
commit c41675aba1
5 changed files with 44 additions and 12 deletions

View file

@ -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),
),
]

View file

@ -563,7 +563,10 @@ class AssoOption(PreferencesModel):
null=True, null=True,
blank=True, blank=True,
) )
description = models.TextField(default="") description = models.TextField(
null=True,
blank=True,
)
class Meta: class Meta:
permissions = ( permissions = (

View file

@ -57,10 +57,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<th>Creations de clubs par tous</th> <th>Creations de clubs par tous</th>
<td>{{ useroptions.all_can_create_club }}</td> <td>{{ useroptions.all_can_create_club }}</td>
</tr> </tr>
<tr>
<th>Auto inscription</th>
<td>{{ useroptions.self_adhesion }}</td>
</tr>
{% if useroptions.user_solde %} {% if useroptions.user_solde %}
<tr> <tr>
<th>Solde maximum</th> <th>Solde maximum</th>
@ -69,6 +65,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<td>{{ useroptions.min_online_payment }}</td> <td>{{ useroptions.min_online_payment }}</td>
</tr> </tr>
{% endif %} {% endif %}
<tr>
<th>Auto inscription</th>
<td>{{ useroptions.self_adhesion }}</td>
</tr>
</table> </table>
<h4>Préférences machines</h4> <h4>Préférences machines</h4>
<a class="btn btn-primary btn-sm" role="button" href="{% url 'preferences:edit-options' 'OptionalMachine' %}"> <a class="btn btn-primary btn-sm" role="button" href="{% url 'preferences:edit-options' 'OptionalMachine' %}">
@ -185,7 +185,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<td>{{ assooptions.utilisateur_asso }}</td> <td>{{ assooptions.utilisateur_asso }}</td>
<th>Moyen de paiement automatique</th> <th>Moyen de paiement automatique</th>
<td>{{ assooptions.payment }}</td> <td>{{ assooptions.payment }}</td>
<th>Description de l'association</th> </tr>
<tr>
<th>Description de l'association</th>
<td>{{ assooptions.description }}</td> <td>{{ assooptions.description }}</td>
</tr> </tr>

View file

@ -32,6 +32,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<h2>Résultats dans les utilisateurs</h2> <h2>Résultats dans les utilisateurs</h2>
{% include "users/aff_users.html" with users_list=users %} {% include "users/aff_users.html" with users_list=users %}
{% endif%} {% endif%}
{% if clubs %}
<h2>Résultats dans les clubs</h2>
{% include "users/aff_clubs.html" with clubs_list=clubs %}
{% endif%}
{% if machines %} {% if machines %}
<h2>Résultats dans les machines : </h2> <h2>Résultats dans les machines : </h2>
{% include "machines/aff_machines.html" with machines_list=machines %} {% include "machines/aff_machines.html" with machines_list=machines %}

View file

@ -31,7 +31,7 @@ from django.shortcuts import render
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
from django.db.models import Q 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 machines.models import Machine
from topologie.models import Port, Switch, Room from topologie.models import Port, Switch, Room
from cotisations.models import Facture from cotisations.models import Facture
@ -133,19 +133,20 @@ def search_single_word(word, filters, user,
filter_users = ( filter_users = (
Q( Q(
surname__icontains=word surname__icontains=word
) | Q(
adherent__name__icontains=word
) | Q( ) | Q(
pseudo__icontains=word pseudo__icontains=word
) | Q( ) | Q(
club__room__name__icontains=word room__name__icontains=word
) | Q( ) | Q(
adherent__room__name__icontains=word room__name__icontains=word
) )
) & Q(state__in=user_state) ) & Q(state__in=user_state)
if not User.can_view_all(user)[0]: if not User.can_view_all(user)[0]:
filter_users &= Q(id=user.id) filter_users &= Q(id=user.id)
filter_clubs = filter_users
filter_users |= Q(name__icontains=word)
filters['users'] |= filter_users filters['users'] |= filter_users
filters['clubs'] |= filter_clubs
# Machines # Machines
if '1' in aff: if '1' in aff:
@ -359,6 +360,7 @@ def get_results(query, request, params):
filters = { filters = {
'users': Q(), 'users': Q(),
'clubs': Q(),
'machines': Q(), 'machines': Q(),
'factures': Q(), 'factures': Q(),
'bans': Q(), 'bans': Q(),
@ -381,7 +383,8 @@ def get_results(query, request, params):
) )
results = { 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']), 'machines': Machine.objects.filter(filters['machines']),
'factures': Facture.objects.filter(filters['factures']), 'factures': Facture.objects.filter(filters['factures']),
'bans': Ban.objects.filter(filters['bans']), 'bans': Ban.objects.filter(filters['bans']),