2016-06-28 10:18:03 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
2016-07-12 09:26:48 +02:00
|
|
|
from django.db import migrations
|
|
|
|
|
2016-06-28 10:18:03 +02:00
|
|
|
|
|
|
|
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:
|
2018-10-06 12:35:49 +02:00
|
|
|
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é "
|
2016-06-28 10:18:03 +02:00
|
|
|
+ "ci-dessous à l'envoi.",
|
2018-10-06 12:35:49 +02:00
|
|
|
comments="{{ nom }} \t fullname de la personne.\n"
|
|
|
|
+ "{{ prenom }} \t prénom de la personne.",
|
|
|
|
)
|
|
|
|
]
|
|
|
|
)
|
2016-06-28 10:18:03 +02:00
|
|
|
|
2016-07-12 09:26:48 +02:00
|
|
|
|
2016-06-28 10:18:03 +02:00
|
|
|
class Migration(migrations.Migration):
|
2018-10-06 12:35:49 +02:00
|
|
|
dependencies = [("gestioncof", "0003_event_image")]
|
2016-06-28 10:18:03 +02:00
|
|
|
|
|
|
|
operations = [
|
|
|
|
# Pas besoin de supprimer le mail lors de la migration dans l'autre
|
|
|
|
# sens.
|
2018-10-06 12:35:49 +02:00
|
|
|
migrations.RunPython(create_mail, migrations.RunPython.noop)
|
2016-06-28 10:18:03 +02:00
|
|
|
]
|