2016-06-06 11:05:33 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
from django.db import migrations, models
|
|
|
|
from django.conf import settings
|
|
|
|
from django.utils import timezone
|
|
|
|
|
|
|
|
def forwards_func(apps, schema_editor):
|
|
|
|
Tirage = apps.get_model("bda", "Tirage")
|
|
|
|
db_alias = schema_editor.connection.alias
|
|
|
|
Tirage.objects.using(db_alias).bulk_create([
|
|
|
|
Tirage(
|
|
|
|
id=1,
|
|
|
|
title="Tirage de test (migration)",
|
2016-06-07 23:07:28 +02:00
|
|
|
active=False,
|
2016-06-06 11:05:33 +02:00
|
|
|
ouverture=timezone.now(),
|
|
|
|
fermeture=timezone.now()),
|
|
|
|
])
|
|
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
|
|
|
|
dependencies = [
|
|
|
|
('bda', '0001_initial'),
|
|
|
|
]
|
|
|
|
|
|
|
|
operations = [
|
|
|
|
migrations.CreateModel(
|
|
|
|
name='Tirage',
|
|
|
|
fields=[
|
|
|
|
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
|
|
|
('title', models.CharField(max_length=300, verbose_name=b'Titre')),
|
|
|
|
('ouverture', models.DateTimeField(verbose_name=b"Date et heure d'ouverture du tirage")),
|
|
|
|
('fermeture', models.DateTimeField(verbose_name=b'Date et heure de fermerture du tirage')),
|
|
|
|
('token', models.TextField(verbose_name=b'Graine du tirage', blank=True)),
|
|
|
|
('active', models.BooleanField(default=True, verbose_name=b'Tirage actif')),
|
|
|
|
],
|
|
|
|
),
|
2016-06-07 00:14:12 +02:00
|
|
|
migrations.RunPython(forwards_func, migrations.RunPython.noop),
|
2016-06-06 11:05:33 +02:00
|
|
|
migrations.AlterField(
|
|
|
|
model_name='participant',
|
|
|
|
name='user',
|
2017-02-22 19:28:34 +01:00
|
|
|
field=models.ForeignKey(
|
|
|
|
on_delete=models.CASCADE,
|
|
|
|
to=settings.AUTH_USER_MODEL),
|
2016-06-06 11:05:33 +02:00
|
|
|
),
|
|
|
|
migrations.AddField(
|
|
|
|
model_name='participant',
|
|
|
|
name='tirage',
|
2017-02-22 19:28:34 +01:00
|
|
|
field=models.ForeignKey(
|
|
|
|
on_delete=models.CASCADE,
|
|
|
|
default=1,
|
|
|
|
to='bda.Tirage'),
|
2016-06-06 11:05:33 +02:00
|
|
|
preserve_default=False,
|
|
|
|
),
|
|
|
|
migrations.AddField(
|
|
|
|
model_name='spectacle',
|
|
|
|
name='tirage',
|
2017-02-22 19:28:34 +01:00
|
|
|
field=models.ForeignKey(
|
|
|
|
on_delete=models.CASCADE,
|
|
|
|
default=1,
|
|
|
|
to='bda.Tirage'),
|
2016-06-06 11:05:33 +02:00
|
|
|
preserve_default=False,
|
|
|
|
),
|
|
|
|
]
|