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:
commit
358d14c01b
5 changed files with 53 additions and 0 deletions
20
preferences/migrations/0025_generaloption_general_message.py
Normal file
20
preferences/migrations/0025_generaloption_general_message.py
Normal 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'),
|
||||||
|
),
|
||||||
|
]
|
20
preferences/migrations/0026_auto_20171216_0401.py
Normal file
20
preferences/migrations/0026_auto_20171216_0401.py
Normal 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'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -102,6 +102,11 @@ class GeneralOption(models.Model):
|
||||||
temps où les liens sont valides"""
|
temps où 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)
|
||||||
|
|
|
@ -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 %}
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue