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:
|
|
|
|
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.")
|
|
|
|
])
|
|
|
|
|
2016-07-12 09:26:48 +02:00
|
|
|
|
2016-06-28 10:18:03 +02:00
|
|
|
class Migration(migrations.Migration):
|
|
|
|
|
|
|
|
dependencies = [
|
2016-07-12 09:28:12 +02:00
|
|
|
('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.
|
|
|
|
migrations.RunPython(create_mail, migrations.RunPython.noop),
|
|
|
|
]
|