-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Diagnostique): nouveau champ service_type pour stocker le type d…
…e service proposé par la cantine (#4720)
- Loading branch information
Showing
6 changed files
with
82 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Generated by Django 5.0.7 on 2024-12-04 12:01 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
def init_service_type(apps, schema_editor): | ||
Diagnostic = apps.get_model("data", "Diagnostic") | ||
for diagnostic in Diagnostic.objects.all(): | ||
if diagnostic.vegetarian_menu_type: | ||
if diagnostic.vegetarian_menu_type == "UNIQUE": | ||
diagnostic.service_type = "UNIQUE" | ||
elif diagnostic.vegetarian_menu_type in ["SEVERAL", "ALTERNATIVES"]: | ||
diagnostic.service_type = "MULTIPLE_SELF" | ||
diagnostic.save(update_fields=["service_type"]) | ||
|
||
def reverse_init_service_type(apps, schema_editor): | ||
pass | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("data", "0159_alter_canteen_line_ministry_and_more"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="diagnostic", | ||
name="service_type", | ||
field=models.CharField( | ||
blank=True, | ||
choices=[ | ||
("UNIQUE", "Menu unique"), | ||
("MULTIPLE_SELF", "Choix multiple en libre-service"), | ||
( | ||
"MULTIPLE_RESERVATION", | ||
"Choix multiple avec réservation à l’avance au jour le jour", | ||
), | ||
], | ||
max_length=255, | ||
null=True, | ||
verbose_name="type de service", | ||
), | ||
), | ||
migrations.AddField( | ||
model_name="historicaldiagnostic", | ||
name="service_type", | ||
field=models.CharField( | ||
blank=True, | ||
choices=[ | ||
("UNIQUE", "Menu unique"), | ||
("MULTIPLE_SELF", "Choix multiple en libre-service"), | ||
( | ||
"MULTIPLE_RESERVATION", | ||
"Choix multiple avec réservation à l’avance au jour le jour", | ||
), | ||
], | ||
max_length=255, | ||
null=True, | ||
verbose_name="type de service", | ||
), | ||
), | ||
migrations.RunPython(init_service_type, reverse_init_service_type), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters