2018-04-09 22:43:25 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
from django.db import migrations, models
|
|
|
|
|
|
|
|
|
|
|
|
def swap_double_choice(apps, schema_editor):
|
|
|
|
choices = apps.get_model("bda", "ChoixSpectacle").objects
|
|
|
|
|
|
|
|
choices.filter(double_choice="double").update(double_choice="tmp")
|
|
|
|
choices.filter(double_choice="autoquit").update(double_choice="double")
|
|
|
|
choices.filter(double_choice="tmp").update(double_choice="autoquit")
|
|
|
|
|
|
|
|
|
|
|
|
class Migration(migrations.Migration):
|
2018-10-06 12:35:49 +02:00
|
|
|
dependencies = [("bda", "0011_tirage_appear_catalogue")]
|
2018-04-09 22:43:25 +02:00
|
|
|
|
|
|
|
operations = [
|
|
|
|
# Temporarily allow an extra "tmp" value for the `double_choice` field
|
|
|
|
migrations.AlterField(
|
2018-10-06 12:35:49 +02:00
|
|
|
model_name="choixspectacle",
|
|
|
|
name="double_choice",
|
2018-04-09 22:43:25 +02:00
|
|
|
field=models.CharField(
|
2018-10-06 12:35:49 +02:00
|
|
|
verbose_name="Nombre de places",
|
2018-04-09 22:43:25 +02:00
|
|
|
max_length=10,
|
2018-10-06 12:35:49 +02:00
|
|
|
default="1",
|
2018-04-09 22:43:25 +02:00
|
|
|
choices=[
|
2018-10-06 12:35:49 +02:00
|
|
|
("tmp", "tmp"),
|
|
|
|
("1", "1 place"),
|
|
|
|
("double", "2 places si possible, 1 sinon"),
|
|
|
|
("autoquit", "2 places sinon rien"),
|
|
|
|
],
|
2018-04-09 22:43:25 +02:00
|
|
|
),
|
|
|
|
),
|
|
|
|
migrations.RunPython(swap_double_choice, migrations.RunPython.noop),
|
|
|
|
migrations.AlterField(
|
2018-10-06 12:35:49 +02:00
|
|
|
model_name="choixspectacle",
|
|
|
|
name="double_choice",
|
2018-04-09 22:43:25 +02:00
|
|
|
field=models.CharField(
|
2018-10-06 12:35:49 +02:00
|
|
|
verbose_name="Nombre de places",
|
2018-04-09 22:43:25 +02:00
|
|
|
max_length=10,
|
2018-10-06 12:35:49 +02:00
|
|
|
default="1",
|
2018-04-09 22:43:25 +02:00
|
|
|
choices=[
|
2018-10-06 12:35:49 +02:00
|
|
|
("1", "1 place"),
|
|
|
|
("double", "2 places si possible, 1 sinon"),
|
|
|
|
("autoquit", "2 places sinon rien"),
|
|
|
|
],
|
2018-04-09 22:43:25 +02:00
|
|
|
),
|
|
|
|
),
|
|
|
|
]
|