2021-12-13 21:34:36 +00:00
|
|
|
# Generated by Django 3.2.9 on 2021-12-13 21:25
|
|
|
|
|
|
|
|
from django.db import migrations
|
|
|
|
|
|
|
|
|
|
|
|
def update_language_en_to_en_us(apps, schema_editor):
|
2022-02-10 00:00:30 +00:00
|
|
|
Settings = apps.get_model("babybuddy", "Settings")
|
2021-12-13 21:34:36 +00:00
|
|
|
for settings in Settings.objects.all():
|
2022-02-10 00:00:30 +00:00
|
|
|
if settings.language == "en":
|
|
|
|
settings.language = "en-US"
|
2021-12-13 21:34:36 +00:00
|
|
|
settings.save()
|
|
|
|
|
|
|
|
|
|
|
|
def update_language_en_us_to_en(apps, schema_editor):
|
2022-02-10 00:00:30 +00:00
|
|
|
Settings = apps.get_model("babybuddy", "Settings")
|
2021-12-13 21:34:36 +00:00
|
|
|
for settings in Settings.objects.all():
|
2022-02-10 00:00:30 +00:00
|
|
|
if settings.language == "en-US":
|
|
|
|
settings.language = "en"
|
2021-12-13 21:34:36 +00:00
|
|
|
settings.save()
|
|
|
|
|
|
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
|
|
|
|
dependencies = [
|
2022-02-10 00:00:30 +00:00
|
|
|
("babybuddy", "0019_alter_settings_timezone"),
|
2021-12-13 21:34:36 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
operations = [
|
2022-02-10 00:00:30 +00:00
|
|
|
migrations.RunPython(
|
|
|
|
update_language_en_to_en_us, reverse_code=update_language_en_us_to_en
|
|
|
|
),
|
2021-12-13 21:34:36 +00:00
|
|
|
]
|