diff --git a/preferences/admin.py b/preferences/admin.py index d4c41e62..867596fe 100644 --- a/preferences/admin.py +++ b/preferences/admin.py @@ -23,7 +23,7 @@ from django.contrib import admin from reversion.admin import VersionAdmin -from .models import OptionalUser, OptionalMachine, OptionalTopologie, GeneralOption, Service, AssoOption +from .models import OptionalUser, OptionalMachine, OptionalTopologie, GeneralOption, Service, AssoOption, MailMessageOption class OptionalUserAdmin(VersionAdmin): pass @@ -31,7 +31,6 @@ class OptionalUserAdmin(VersionAdmin): class OptionalTopologieAdmin(VersionAdmin): pass - class OptionalMachineAdmin(VersionAdmin): pass @@ -44,9 +43,13 @@ class ServiceAdmin(VersionAdmin): class AssoOptionAdmin(VersionAdmin): pass +class MailMessageOptionAdmin(VersionAdmin): + pass + admin.site.register(OptionalUser, OptionalUserAdmin) admin.site.register(OptionalMachine, OptionalMachineAdmin) admin.site.register(OptionalTopologie, OptionalTopologieAdmin) admin.site.register(GeneralOption, GeneralOptionAdmin) admin.site.register(Service, ServiceAdmin) admin.site.register(AssoOption, AssoOptionAdmin) +admin.site.register(MailMessageOption, MailMessageOptionAdmin) diff --git a/preferences/forms.py b/preferences/forms.py index 37e9c7ea..1c1188c7 100644 --- a/preferences/forms.py +++ b/preferences/forms.py @@ -22,7 +22,7 @@ from django.forms import ModelForm, Form, ValidationError from django import forms -from .models import OptionalUser, OptionalMachine, OptionalTopologie, GeneralOption, AssoOption, Service +from .models import OptionalUser, OptionalMachine, OptionalTopologie, GeneralOption, AssoOption, MailMessageOption, Service from django.db.models import Q class EditOptionalUserForm(ModelForm): @@ -72,6 +72,16 @@ class EditAssoOptionForm(ModelForm): model = AssoOption fields = '__all__' +class EditMailMessageOptionForm(ModelForm): + class Meta: + model = MailMessageOption + fields = '__all__' + + def __init__(slef, *args, **kwargs): + super(EditMailMessageOptionForm, self).__init__(*args, **kwargs) + self.fields['welcome_mail_fr'].label = 'Message dans le mail d\'acceuil en français' + self.fields['welcome_mail_en'].label = 'Message dans le mail d\'acceuil en anglais' + class ServiceForm(ModelForm): class Meta: model = Service diff --git a/preferences/migrations/0017_mailmessageoption.py b/preferences/migrations/0017_mailmessageoption.py new file mode 100644 index 00000000..31fb145c --- /dev/null +++ b/preferences/migrations/0017_mailmessageoption.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.7 on 2017-09-08 20:17 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('preferences', '0016_auto_20170902_1520'), + ] + + operations = [ + migrations.CreateModel( + name='MailMessageOption', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('welcome_mail_fr', models.TextField(default='')), + ('welcome_mail_en', models.TextField(default='')), + ], + ), + ] diff --git a/preferences/models.py b/preferences/models.py index 92822190..b56faf3d 100644 --- a/preferences/models.py +++ b/preferences/models.py @@ -87,3 +87,10 @@ class AssoOption(models.Model): telephone = models.CharField(max_length=15, default="0000000000") pseudo = models.CharField(default="Asso", max_length=32) utilisateur_asso = models.OneToOneField('users.User', on_delete=models.PROTECT, blank=True, null=True) + +class MailMessageOption(models.Model): + PRETTY_NAME = "Options de corps de mail" + + welcome_mail_fr = models.TextField(default="") + welcome_mail_en = models.TextField(default="") + diff --git a/preferences/templates/preferences/display_preferences.html b/preferences/templates/preferences/display_preferences.html index 394a4714..515404e7 100644 --- a/preferences/templates/preferences/display_preferences.html +++ b/preferences/templates/preferences/display_preferences.html @@ -155,6 +155,25 @@ with this program; if not, write to the Free Software Foundation, Inc.,
+
+Message Français | +{{ mailmessageoptions.welcome_mail_fr }} | +
---|---|
Message Anglais | +{{ mailmessageoptions.welcome_mail_en }} | +
Votre pseudo est : {{pseudo}}
-{{personalized_message_fr}} +{{welcome_mail_fr|safe}}Pour nous faire part de toute remarque, suggestion ou problème vous pouvez nous envoyer un mail à {{asso_email}}.
@@ -17,7 +17,7 @@ L'équipe de {{asso_name}}.Your username is : {{pseudo}}
-{{personalized_message_en}} +{{welcome_mail_en|safe}}
For any information, suggestion or problem, you can contact us via email at
{{asso_email}}.