forked from openedx/course-discovery
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add telugu language tag to languageTag model (openedx#4145)
- Loading branch information
1 parent
8911009
commit 2c68e9e
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
course_discovery/apps/ietf_language_tags/migrations/0005_add_telugu_lan_tag.py
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,24 @@ | ||
# Generated by Django 3.2.22 on 2023-10-12 12:11 | ||
from django.db import migrations | ||
|
||
TELUGU_LANG_TAG = ('Telugu', 'te') | ||
|
||
def add_telugu_language_tag(apps, schema_editor): # pylint: disable=unused-argument | ||
LanguageTag = apps.get_model('ietf_language_tags', 'LanguageTag') | ||
LanguageTagTranslation = apps.get_model('ietf_language_tags', 'LanguageTagTranslation') | ||
|
||
LanguageTag.objects.update_or_create(code=TELUGU_LANG_TAG[1], defaults={'name': TELUGU_LANG_TAG[0]}) | ||
LanguageTagTranslation.objects.update_or_create( | ||
master=LanguageTag.objects.get(code=TELUGU_LANG_TAG[1]), | ||
language_code='en', | ||
defaults={'name_t': TELUGU_LANG_TAG[0]} | ||
) | ||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
('ietf_language_tags', '0004_auto_20200804_1401'), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(add_telugu_language_tag, migrations.RunPython.noop), | ||
] |