Skip to content

Commit

Permalink
Fix abbreviations on weekday names
Browse files Browse the repository at this point in the history
Fixes #298
  • Loading branch information
ACK1D authored and lb- committed Jan 31, 2024
1 parent 6f41aef commit a171a4b
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 39 deletions.
72 changes: 36 additions & 36 deletions bakerydemo/base/fixtures/bakerydemo.json
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@
"pk": 2,
"fields": {
"sort_order": 1,
"day": "TUES",
"day": "TUE",
"opening_time": "08:00:00",
"closing_time": "20:00:00",
"closed": false,
Expand All @@ -717,7 +717,7 @@
"pk": 4,
"fields": {
"sort_order": 3,
"day": "THUR",
"day": "THU",
"opening_time": "08:00:00",
"closing_time": "17:00:00",
"closed": false,
Expand All @@ -741,7 +741,7 @@
"pk": 6,
"fields": {
"sort_order": 1,
"day": "TUES",
"day": "TUE",
"opening_time": "09:00:00",
"closing_time": "20:00:00",
"closed": false,
Expand All @@ -765,7 +765,7 @@
"pk": 8,
"fields": {
"sort_order": 3,
"day": "THUR",
"day": "THU",
"opening_time": "09:00:00",
"closing_time": "22:00:00",
"closed": false,
Expand All @@ -789,7 +789,7 @@
"pk": 10,
"fields": {
"sort_order": 1,
"day": "TUES",
"day": "TUE",
"opening_time": "05:00:00",
"closing_time": "21:00:00",
"closed": false,
Expand All @@ -813,7 +813,7 @@
"pk": 12,
"fields": {
"sort_order": 3,
"day": "THUR",
"day": "THU",
"opening_time": "07:00:00",
"closing_time": "19:00:00",
"closed": false,
Expand All @@ -837,7 +837,7 @@
"pk": 14,
"fields": {
"sort_order": 1,
"day": "TUES",
"day": "TUE",
"opening_time": null,
"closing_time": null,
"closed": true,
Expand All @@ -861,7 +861,7 @@
"pk": 16,
"fields": {
"sort_order": 3,
"day": "THUR",
"day": "THU",
"opening_time": "09:00:00",
"closing_time": "18:00:00",
"closed": false,
Expand Down Expand Up @@ -1029,7 +1029,7 @@
"pk": 30,
"fields": {
"sort_order": 1,
"day": "TUES",
"day": "TUE",
"opening_time": "09:00:00",
"closing_time": "20:00:00",
"closed": false,
Expand All @@ -1053,7 +1053,7 @@
"pk": 32,
"fields": {
"sort_order": 3,
"day": "THUR",
"day": "THU",
"opening_time": "09:00:00",
"closing_time": "22:00:00",
"closed": false,
Expand Down Expand Up @@ -1113,7 +1113,7 @@
"pk": 37,
"fields": {
"sort_order": 1,
"day": "TUES",
"day": "TUE",
"opening_time": "09:00:00",
"closing_time": "20:00:00",
"closed": false,
Expand All @@ -1137,7 +1137,7 @@
"pk": 39,
"fields": {
"sort_order": 3,
"day": "THUR",
"day": "THU",
"opening_time": "09:00:00",
"closing_time": "22:00:00",
"closed": false,
Expand Down Expand Up @@ -5504,7 +5504,7 @@
{
"pk": 2,
"sort_order": 1,
"day": "TUES",
"day": "TUE",
"opening_time": "08:00:00",
"closing_time": "20:00:00",
"closed": false,
Expand All @@ -5522,7 +5522,7 @@
{
"pk": 4,
"sort_order": 3,
"day": "THUR",
"day": "THU",
"opening_time": "08:00:00",
"closing_time": "17:00:00",
"closed": false,
Expand Down Expand Up @@ -5619,7 +5619,7 @@
{
"pk": 2,
"sort_order": 1,
"day": "TUES",
"day": "TUE",
"opening_time": "08:00:00",
"closing_time": "20:00:00",
"closed": false,
Expand All @@ -5637,7 +5637,7 @@
{
"pk": 4,
"sort_order": 3,
"day": "THUR",
"day": "THU",
"opening_time": "08:00:00",
"closing_time": "17:00:00",
"closed": false,
Expand Down Expand Up @@ -5734,7 +5734,7 @@
{
"pk": 6,
"sort_order": 1,
"day": "TUES",
"day": "TUE",
"opening_time": "09:00:00",
"closing_time": "20:00:00",
"closed": false,
Expand All @@ -5752,7 +5752,7 @@
{
"pk": 8,
"sort_order": 3,
"day": "THUR",
"day": "THU",
"opening_time": "09:00:00",
"closing_time": "22:00:00",
"closed": false,
Expand Down Expand Up @@ -5849,7 +5849,7 @@
{
"pk": 6,
"sort_order": 1,
"day": "TUES",
"day": "TUE",
"opening_time": "09:00:00",
"closing_time": "20:00:00",
"closed": false,
Expand All @@ -5867,7 +5867,7 @@
{
"pk": 8,
"sort_order": 3,
"day": "THUR",
"day": "THU",
"opening_time": "09:00:00",
"closing_time": "22:00:00",
"closed": false,
Expand Down Expand Up @@ -5964,7 +5964,7 @@
{
"pk": 10,
"sort_order": 1,
"day": "TUES",
"day": "TUE",
"opening_time": "05:00:00",
"closing_time": "21:00:00",
"closed": false,
Expand All @@ -5982,7 +5982,7 @@
{
"pk": 12,
"sort_order": 3,
"day": "THUR",
"day": "THU",
"opening_time": "07:00:00",
"closing_time": "19:00:00",
"closed": false,
Expand Down Expand Up @@ -6079,7 +6079,7 @@
{
"pk": 10,
"sort_order": 1,
"day": "TUES",
"day": "TUE",
"opening_time": "05:00:00",
"closing_time": "21:00:00",
"closed": false,
Expand All @@ -6097,7 +6097,7 @@
{
"pk": 12,
"sort_order": 3,
"day": "THUR",
"day": "THU",
"opening_time": "07:00:00",
"closing_time": "19:00:00",
"closed": false,
Expand Down Expand Up @@ -6194,7 +6194,7 @@
{
"pk": 14,
"sort_order": 1,
"day": "TUES",
"day": "TUE",
"opening_time": null,
"closing_time": null,
"closed": true,
Expand All @@ -6212,7 +6212,7 @@
{
"pk": 16,
"sort_order": 3,
"day": "THUR",
"day": "THU",
"opening_time": "09:00:00",
"closing_time": "18:00:00",
"closed": false,
Expand Down Expand Up @@ -6309,7 +6309,7 @@
{
"pk": 14,
"sort_order": 1,
"day": "TUES",
"day": "TUE",
"opening_time": null,
"closing_time": null,
"closed": true,
Expand All @@ -6327,7 +6327,7 @@
{
"pk": 16,
"sort_order": 3,
"day": "THUR",
"day": "THU",
"opening_time": "09:00:00",
"closing_time": "18:00:00",
"closed": false,
Expand Down Expand Up @@ -6424,7 +6424,7 @@
{
"pk": 30,
"sort_order": 1,
"day": "TUES",
"day": "TUE",
"opening_time": "09:00:00",
"closing_time": "20:00:00",
"closed": false,
Expand All @@ -6442,7 +6442,7 @@
{
"pk": 32,
"sort_order": 3,
"day": "THUR",
"day": "THU",
"opening_time": "09:00:00",
"closing_time": "22:00:00",
"closed": false,
Expand Down Expand Up @@ -6539,7 +6539,7 @@
{
"pk": 30,
"sort_order": 1,
"day": "TUES",
"day": "TUE",
"opening_time": "09:00:00",
"closing_time": "20:00:00",
"closed": false,
Expand All @@ -6557,7 +6557,7 @@
{
"pk": 32,
"sort_order": 3,
"day": "THUR",
"day": "THU",
"opening_time": "09:00:00",
"closing_time": "22:00:00",
"closed": false,
Expand Down Expand Up @@ -6654,7 +6654,7 @@
{
"pk": 37,
"sort_order": 1,
"day": "TUES",
"day": "TUE",
"opening_time": "09:00:00",
"closing_time": "20:00:00",
"closed": false,
Expand All @@ -6672,7 +6672,7 @@
{
"pk": 39,
"sort_order": 3,
"day": "THUR",
"day": "THU",
"opening_time": "09:00:00",
"closing_time": "22:00:00",
"closed": false,
Expand Down Expand Up @@ -6769,7 +6769,7 @@
{
"pk": 37,
"sort_order": 1,
"day": "TUES",
"day": "TUE",
"opening_time": "09:00:00",
"closing_time": "20:00:00",
"closed": false,
Expand All @@ -6787,7 +6787,7 @@
{
"pk": 39,
"sort_order": 3,
"day": "THUR",
"day": "THU",
"opening_time": "09:00:00",
"closing_time": "22:00:00",
"closed": false,
Expand Down
4 changes: 2 additions & 2 deletions bakerydemo/locations/choices.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
DAY_CHOICES = (
("MON", "Monday"),
("TUES", "Tuesday"),
("TUE", "Tuesday"),
("WED", "Wednesday"),
("THUR", "Thursday"),
("THU", "Thursday"),
("FRI", "Friday"),
("SAT", "Saturday"),
("SUN", "Sunday"),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Generated by Django 4.2.8 on 2023-12-07 18:36

from django.db import migrations, models


def forwards_func(apps, schema_editor):
OperatingHours = apps.get_model("locations", "locationoperatinghours")
db_alias = schema_editor.connection.alias
OperatingHours.objects.using(db_alias).filter(day="TUES").update(day="TUE")
OperatingHours.objects.using(db_alias).filter(day="THUR").update(day="THU")


def reverse_func(apps, schema_editor):
OperatingHours = apps.get_model("locations", "locationoperatinghours")
db_alias = schema_editor.connection.alias
OperatingHours.objects.using(db_alias).filter(day="TUE").update(day="TUES")
OperatingHours.objects.using(db_alias).filter(day="THU").update(day="THUR")


class Migration(migrations.Migration):

dependencies = [
("locations", "0005_use_json_field_for_body_streamfield"),
]

operations = [
migrations.RunPython(forwards_func, reverse_func),
migrations.AlterField(
model_name="locationoperatinghours",
name="day",
field=models.CharField(
choices=[
("MON", "Monday"),
("TUE", "Tuesday"),
("WED", "Wednesday"),
("THU", "Thursday"),
("FRI", "Friday"),
("SAT", "Saturday"),
("SUN", "Sunday"),
],
default="MON",
max_length=3,
),
),
]
2 changes: 1 addition & 1 deletion bakerydemo/locations/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class OperatingHours(models.Model):
A Django model to capture operating hours for a Location
"""

day = models.CharField(max_length=4, choices=DAY_CHOICES, default="MON")
day = models.CharField(max_length=3, choices=DAY_CHOICES, default="MON")
opening_time = models.TimeField(blank=True, null=True)
closing_time = models.TimeField(blank=True, null=True)
closed = models.BooleanField(
Expand Down

0 comments on commit a171a4b

Please sign in to comment.