8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-23 03:43:12 +00:00

Merge branch 'messages' into 'master'

Possibilité d'afficher un message global

See merge request federez/re2o!48
This commit is contained in:
Gabriel Detraz 2017-12-17 16:39:22 +01:00
commit 358d14c01b
5 changed files with 53 additions and 0 deletions

View file

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-12-16 02:38
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('preferences', '0024_optionaluser_all_can_create'),
]
operations = [
migrations.AddField(
model_name='generaloption',
name='general_message',
field=models.TextField(default='', help_text='Message général affiché sur le site (maintenance, etc'),
),
]

View file

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-12-16 03:01
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('preferences', '0025_generaloption_general_message'),
]
operations = [
migrations.AlterField(
model_name='generaloption',
name='general_message',
field=models.TextField(blank=True, default='', help_text='Message général affiché sur le site (maintenance, etc'),
),
]

View file

@ -102,6 +102,11 @@ class GeneralOption(models.Model):
temps les liens sont valides"""
PRETTY_NAME = "Options générales"
general_message = models.TextField(
default="",
blank=True,
help_text="Message général affiché sur le site (maintenance, etc"
)
search_display_page = models.IntegerField(default=15)
pagination_number = models.IntegerField(default=25)
pagination_large_number = models.IntegerField(default=8)

View file

@ -131,6 +131,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<th>Temps avant expiration du lien de reinitialisation de mot de passe (en heures)</th>
<td>{{ generaloptions.req_expire_hrs }}</td>
</tr>
<tr>
<th>Message global affiché sur le site</th>
<td>{{ generaloptions.general_message }}</td>
<tr>
</table>
<h4>Données de l'association</h4>
{% if is_bureau %}

View file

@ -23,6 +23,7 @@
from __future__ import unicode_literals
from django.contrib import messages
from preferences.models import GeneralOption, OptionalMachine
@ -33,6 +34,9 @@ def context_user(request):
general_options, _created = GeneralOption.objects.get_or_create()
machine_options, _created = OptionalMachine.objects.get_or_create()
user = request.user
global_message = general_options.general_message
if global_message:
messages.warning(request, global_message)
if user.is_authenticated():
interfaces = user.user_interfaces()
is_cableur = user.is_cableur