From dce7d3df2ab81b65268cbd2d417df7e945d8693c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20P=C3=A9pin?= Date: Tue, 28 Jun 2016 10:18:03 +0200 Subject: [PATCH 1/2] Ajout du mail de confirmation d'inscription au COF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Il est envoyé automatiquement à l'inscription est donc nécessaire à la correcte exécution de la vue `registration`. Fixes #40 --- .../migrations/0003_registration_mail.py | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 gestioncof/migrations/0003_registration_mail.py diff --git a/gestioncof/migrations/0003_registration_mail.py b/gestioncof/migrations/0003_registration_mail.py new file mode 100644 index 00000000..97caff31 --- /dev/null +++ b/gestioncof/migrations/0003_registration_mail.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + +def create_mail(apps, schema_editor): + CustomMail = apps.get_model("gestioncof", "CustomMail") + db_alias = schema_editor.connection.alias + if CustomMail.objects.filter(shortname="bienvenue").count() == 0: + CustomMail.objects.using(db_alias).bulk_create([ + CustomMail( + shortname="bienvenue", + title="Bienvenue au COF", + content="Mail de bienvenue au COF, envoyé automatiquement à " \ + + "l'inscription.\n\n" \ + + "Les balises {{ ... }} sont interprétées comme expliqué " \ + + "ci-dessous à l'envoi.", + comments="{{ nom }} \t fullname de la personne.\n"\ + + "{{ prenom }} \t prénom de la personne.") + ]) + +class Migration(migrations.Migration): + + dependencies = [ + ('gestioncof', '0002_enable_unprocessed_demandes'), + ] + + operations = [ + # Pas besoin de supprimer le mail lors de la migration dans l'autre + # sens. + migrations.RunPython(create_mail, migrations.RunPython.noop), + ] From a352ebd9eee497f1fb376ca2c6064d94a5da77bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20P=C3=A9pin?= Date: Sun, 10 Jul 2016 14:32:38 +0200 Subject: [PATCH 2/2] Rename migration --- .../{0003_registration_mail.py => 0004_registration_mail.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename gestioncof/migrations/{0003_registration_mail.py => 0004_registration_mail.py} (100%) diff --git a/gestioncof/migrations/0003_registration_mail.py b/gestioncof/migrations/0004_registration_mail.py similarity index 100% rename from gestioncof/migrations/0003_registration_mail.py rename to gestioncof/migrations/0004_registration_mail.py