8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-05 09:26:27 +00:00

Possibilité d'afficher un message global

This commit is contained in:
Gabriel Detraz 2017-12-16 04:01:39 +01:00 committed by root
parent 7ccd7f1c0e
commit 00cf95423e
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""" temps les liens sont valides"""
PRETTY_NAME = "Options générales" 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) search_display_page = models.IntegerField(default=15)
pagination_number = models.IntegerField(default=25) pagination_number = models.IntegerField(default=25)
pagination_large_number = models.IntegerField(default=8) 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> <th>Temps avant expiration du lien de reinitialisation de mot de passe (en heures)</th>
<td>{{ generaloptions.req_expire_hrs }}</td> <td>{{ generaloptions.req_expire_hrs }}</td>
</tr> </tr>
<tr>
<th>Message global affiché sur le site</th>
<td>{{ generaloptions.general_message }}</td>
<tr>
</table> </table>
<h4>Données de l'association</h4> <h4>Données de l'association</h4>
{% if is_bureau %} {% if is_bureau %}

View file

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