0006_alter_locationoperatinghours_day.py 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. # Generated by Django 4.2.8 on 2023-12-07 18:36
  2. from django.db import migrations, models
  3. def forwards_func(apps, schema_editor):
  4. OperatingHours = apps.get_model("locations", "locationoperatinghours")
  5. db_alias = schema_editor.connection.alias
  6. OperatingHours.objects.using(db_alias).filter(day="TUES").update(day="TUE")
  7. OperatingHours.objects.using(db_alias).filter(day="THUR").update(day="THU")
  8. def reverse_func(apps, schema_editor):
  9. OperatingHours = apps.get_model("locations", "locationoperatinghours")
  10. db_alias = schema_editor.connection.alias
  11. OperatingHours.objects.using(db_alias).filter(day="TUE").update(day="TUES")
  12. OperatingHours.objects.using(db_alias).filter(day="THU").update(day="THUR")
  13. class Migration(migrations.Migration):
  14. dependencies = [
  15. ("locations", "0005_use_json_field_for_body_streamfield"),
  16. ]
  17. operations = [
  18. migrations.RunPython(forwards_func, reverse_func),
  19. migrations.AlterField(
  20. model_name="locationoperatinghours",
  21. name="day",
  22. field=models.CharField(
  23. choices=[
  24. ("MON", "Monday"),
  25. ("TUE", "Tuesday"),
  26. ("WED", "Wednesday"),
  27. ("THU", "Thursday"),
  28. ("FRI", "Friday"),
  29. ("SAT", "Saturday"),
  30. ("SUN", "Sunday"),
  31. ],
  32. default="MON",
  33. max_length=3,
  34. ),
  35. ),
  36. ]