Ce serveur Gitlab sera éteint le 30 juin 2020, pensez à migrer vos projets vers les serveurs gitlab-research.centralesupelec.fr et gitlab-student.centralesupelec.fr !

Commit 00cf9542 authored by Gabriel Detraz's avatar Gabriel Detraz Committed by root

Possibilité d'afficher un message global

parent 7ccd7f1c
# -*- 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'),
),
]
# -*- 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'),
),
]
......@@ -102,6 +102,11 @@ class GeneralOption(models.Model):
temps où 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)
......
......@@ -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 %}
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment