WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit ab0c2c7

Browse files
authored
Fix default_locale erroneously set to lowercase for spanish add-ons&collections (#23865)
1 parent d87ab61 commit ab0c2c7

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Generated by Django 4.2.23 on 2025-09-02 11:46
2+
3+
from django.db import migrations
4+
5+
6+
# default_locale is supposed to be case-sensitive, although the collation
7+
# we use in MySQL is hiding that. We erroneously set default_locale="es-es"
8+
# on some add-ons in previous migration instead of es-ES, this fixes that.
9+
10+
def forwards_func(apps, schema_editor):
11+
Addon = apps.get_model('addons', 'Addon')
12+
Addon.unfiltered.filter(default_locale='es-es').update(default_locale='es-ES')
13+
14+
15+
def backwards_func(apps, schema_editor):
16+
Addon = apps.get_model('addons', 'Addon')
17+
Addon.unfiltered.filter(default_locale='es-es').update(default_locale='es-es')
18+
19+
20+
class Migration(migrations.Migration):
21+
22+
dependencies = [
23+
('addons', '0055_create_addon_listing_info_table'),
24+
]
25+
26+
operations = [
27+
migrations.RunPython(forwards_func, backwards_func)
28+
]
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Generated by Django 4.2.23 on 2025-09-02 11:55
2+
3+
from django.db import migrations
4+
5+
# default_locale is supposed to be case-sensitive, although the collation
6+
# we use in MySQL is hiding that. We erroneously set default_locale="es-es"
7+
# on some collection in previous migration instead of es-ES, this fixes that.
8+
9+
def forwards_func(apps, schema_editor):
10+
Collection = apps.get_model('bandwagon', 'Collection')
11+
Collection.unfiltered.filter(default_locale='es-es').update(default_locale='es-ES')
12+
13+
14+
def backwards_func(apps, schema_editor):
15+
Collection = apps.get_model('bandwagon', 'Collection')
16+
Collection.unfiltered.filter(default_locale='es-es').update(default_locale='es-es')
17+
18+
19+
class Migration(migrations.Migration):
20+
21+
dependencies = [
22+
('bandwagon', '0009_update_default_locale_es_to_es-es'),
23+
]
24+
25+
operations = [
26+
migrations.RunPython(forwards_func, backwards_func)
27+
]

0 commit comments

Comments
 (0)