From 9df9149894585c26bf51ce17f66cb9c62b9fc58d Mon Sep 17 00:00:00 2001 From: grisel-davy Date: Fri, 17 Aug 2018 13:16:03 +0200 Subject: [PATCH] jout de l'option de redirection des mails --- preferences/forms.py | 2 ++ .../migrations/0050_auto_20180817_1308.py | 25 +++++++++++++++++++ preferences/models.py | 2 ++ .../preferences/display_preferences.html | 8 ++++++ 4 files changed, 37 insertions(+) create mode 100644 preferences/migrations/0050_auto_20180817_1308.py diff --git a/preferences/forms.py b/preferences/forms.py index 02463103..ed3fefce 100644 --- a/preferences/forms.py +++ b/preferences/forms.py @@ -126,6 +126,8 @@ class EditGeneralOptionForm(ModelForm): self.fields['email_from'].label = "Adresse mail d\ 'expedition automatique" self.fields['GTU_sum_up'].label = "Résumé des CGU" + self.fields['all_mail_redirect'].label = "Redirection de tout les mails" + self.fields['redirect_address'].label = 'Adresse de redirection' class EditAssoOptionForm(ModelForm): diff --git a/preferences/migrations/0050_auto_20180817_1308.py b/preferences/migrations/0050_auto_20180817_1308.py new file mode 100644 index 00000000..f6cbd884 --- /dev/null +++ b/preferences/migrations/0050_auto_20180817_1308.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.7 on 2018-08-17 11:08 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('preferences', '0049_optionaluser_self_change_shell'), + ] + + operations = [ + migrations.AddField( + model_name='generaloption', + name='all_mail_redirect', + field=models.BooleanField(default=True, help_text='Redirect all sent mail to the choosen address'), + ), + migrations.AddField( + model_name='generaloption', + name='redirect_address', + field=models.EmailField(default='no-reply@example.com', help_text='Where to redirect all mails', max_length=254), + ), + ] diff --git a/preferences/models.py b/preferences/models.py index 0ebb2fec..671979d6 100644 --- a/preferences/models.py +++ b/preferences/models.py @@ -237,6 +237,8 @@ class GeneralOption(AclMixin, PreferencesModel): req_expire_hrs = models.IntegerField(default=48) site_name = models.CharField(max_length=32, default="Re2o") email_from = models.EmailField(default="www-data@example.com") + all_mail_redirect = models.BooleanField(default=True, help_text="Redirect all sent mail to the choosen address") + redirect_address = models.EmailField(default="no-reply@example.com", help_text="Where to redirect all mails") GTU_sum_up = models.TextField( default="", blank=True, diff --git a/preferences/templates/preferences/display_preferences.html b/preferences/templates/preferences/display_preferences.html index a7ada02b..55c07d00 100644 --- a/preferences/templates/preferences/display_preferences.html +++ b/preferences/templates/preferences/display_preferences.html @@ -160,6 +160,14 @@ with this program; if not, write to the Free Software Foundation, Inc., CGU {{generaloptions.GTU}} + + Redirection des mails envoyés + {{ generaloptions.all_mail_redirect|tick }} + {% if generaloptions.all_mail_redirect %} + Adresse mail de redirection + {{ generaloptions.redirect_address }} + {% endif %} +